Skip to content

Troubleshooting

Eberhard Beilharz edited this page Jul 5, 2013 · 23 revisions

Table of Contents

Working on Features

Creating a feature branch

JohnT: If you get a message something like this: "Branches 'develop' and 'origin/develop' have diverged. And branch 'develop' may be fast-forwarded." you are probably working with an old version of the repo and need to get it again. EberhardB: To get it again, you can call Tools-->Rebase/Update in Git Gui. (AlistairI: To get it again, you may need to do all the following in Git Gui (or possibly a subset): Remote => Fetch from => origin; Branch => Checkout => develop; Merge => Local Merge => select Tracking Branch and origin/develop.)

Another way to get this message is if you are still on another feature branch. After submitting a feature you should check out the main develop branch (Git gui: Branch/Checkout).

When you committed some changes to the wrong feature

It's very easy to forget to make a new feature branch for a new problem. If you realize you made some changes before committing them, I think you can stash them, then make the proper new feature and unstash them. (Someone please describe this.) If you realize it after you commit, but before submitting, you can do this:

- make the new feature branch (and check it out...in git gui Tools/Feature/Start automatically does this). - in git bash: git cherry-pick feature/oldBranch (where oldbranch is the one where you accidentally made the change) - check out the old branch. - in git bash: git reset --hard HEAD^ (or: in gitk right click on the previous commit and select "Reset feature/oldbranch to here", then in the "Confirm reset" dialog choose "Hard")

This assumes there's only one unwanted commit on the wrong branch. I'm not sure how to modify if for more than one...if you figure it out please update this!

If you submitted it for code review on the wrong branch...any ideas? Maybe you can abandon the change on Gerrit and then use the process above? Haven't had to try this yet...

Implement Feature

Incorporating a finished feature

JohnT: Minimally you should make sure you have the latest from origin and that you have rebased your changes on that. This minimizes the chance of having to rebase after your changes are approved in Gerrit. Todo: describe how.

RickM: these are the steps... 1) In the Git Gui tool select Branch: Checkout : develop 2) Tools: Rebase

Squash commits by rebasing

The review process

Working on something else while the change gets reviewed

JohnT: What if the new task is a distinct Jira issue, yet depends on the pending change? How can I create a new feature branch based on the pending one? Or should I do something else?

EberhardB: When you create the feature branch you can add another parameter what the feature is based upon. So if you previously worked on ABC-123 and your new feature ABC-244 depends on your changes for ABC-123 you'd enter the following in the feature start dialog: ABC-244 feature/ABC-123. Note that rebasing the new feature gets a little trickier, especially if you make changes to ABC-123 and resubmit that for review again.

Updating the change based on review comments

Finishing feature

Sharing a Feature

Joining Work on a Feature

Problems with git

To recover from problems with git when you try do update your repo and you get unexpected rebase conflicts, you can try the following in git bash:

    cd fwrepo/fw
    git rebase --abort
    git fetch origin
    git checkout develop
    git reset --hard remotes/origin/develop

This basically throws away any local changes and sets the develop branch to the commit the remote repo has for the develop branch.

Clone this wiki locally