And you should at least compile test the new commits. But whenever you do use it, you need to be aware of the fact that you are lying about history. I am not saying that you shouldn't use git rebase. The consequence of this may be, that you can't distinguish which of the three commits E, F, and G actually introduced a regression, diminishing the value of git bisect. It is actually quite easy to create nonsensical commits via a rebase, especially when the changes in master are important to the development in b1. The point is, that the commits E', F', and G' never truly existed, and have likely never been tested. The rebase, however, gives you this history: A - B - C - D <- master The merge results in the true history: A - B - C - D <- master Consider this commit graph: A - B - C - D <- master However, this linear history is a lie, and you should be aware that it is. 1 Answer Checkout each branch: git checkout b1 Then merge: git merge origin/master Then push: git push origin b1 With rebase use the following commands. People like this approach because it retains a linear history in all branches. The commands are analogue to the merge case: git checkout b1 People with an SVN, or similar background find this more intuitive. git pull origin master fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master. The only difference is, which branch ends up pointing to this merge commit. Fetch the remote, bringing the branches and their commits from the remote repository. It simply does not care whether branch b1 merges master, or master merges b1, the merge commit looks all the same to git. Updating a feature branch git checkout master. You can trust it be able to get all threads together correctly. Git can handle this situation really well, it is designed for merges happening in all directions, at the same time. This leaves the history exactly as it happened: You forked from master, you made changes to all branches, and finally you incorporated the changes from master into all three branches. That is actually quite simple, and a perfectly local operation: git checkout b1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |