I've just started using Git and find that whilst I am implementing a feature in a branch, I will encounter some bug that really needs to be pushed to the trunk as soon as possible. In order to do so, I use checkout to switch back to the trunk, make my changes and commit them. I now have a trunk that is bug free.
Unfortunately, my branch needs to have this bug fixed as well. As the feature is not complete, I can't just merge the branch back into the trunk. How can I alter my branch so that it receives the changes I made to the trunk?
If it matters, I am developing on my own and so only have a single repository to worry about.
I am using TortoiseGit so instructions specific to that would be helpful but not necessary.
Select "HEAD revision in the repository" in "Create copy in the repository from" section. [Here actually you create a new branch from a particular trunk revision]. Tick "Switch working copy to new branch/tag". [This will make your working code directory connected with the newly created branch] Then select "OK".
To switch back, just provide the URL to the location in the repository from which you originally checked out your working copy: $ svn switch http://svn.red-bean.com/repos/trunk/vendors .
Make sure you have your branch checked out (git checkout branch-name
) and run
git rebase master
And resolve any conflicts that arrive.
If you aren't sure what these commands do, try not using TortoiseGit and use the terminal. It will help you really understand the commands.
WARNING: This assumes a local branch. If you have shared the branch, do not run the rebase (because it modifies history). Run
git merge master
while you are on your other branch. This has less clean history, but can be used.
The difference is:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With