![]() ![]() ![]() With any luck, that will find you a commit in the github history that has the exact tree you started with. Github_base=`git log -pretty=%H\ %T github/master | sed -n "s/$root_tree//p"` Myroot=`git rev-list master -max-parents=0` Start this way: git remote add github u://r/l What you can do is to fetch the github repo and find which tree in its history is most similar to the one you started with. What you want to do is to rebase your branch on a reasonable ( any reasonable) commit in the existing history. This looks like undesirable behavior on github's part, but it's fairly easy to fix. You also can redo each commit manually, if you have to. There are several different ways that you can redo your If you redo your commits on top of the original history, you should then be able You can see that by doing a reverse log of your master branch and the History of the original repo, since your new repo won't have any of the same That the history of your repo will be completely different from the Repo instead of cloning the original repo, right? Doing that will make it so You probably downloaded the original source and added it to a completely new Master and upstreambranch are entirely different commit histories. Here is a screenshot of the temporary fork I made of your repo, where I tried toĬompare master with the upstreambranch, like you described. (I call the commits E1' and E2' in the illustration to indicate that they are just copies.) The old commits will exist until they are garbage collected, but will not be reachable unless you look at the reflog.) A - B - C - D - E - F - G <-masterĮxecuting git checkout master git merge -ff-only branch-b will now fast-forward your changes into master, thereby giving you a linear history.It looks like GitHub won't let you compare the branches because they don'tĪctually share any of the same history at all, even though they may share This creates new commits that are copies of the old commits, i.e., the same change-set, author information and message, but new committer information and parent history. ![]() So, instead of merging you first execute the following while on branch-b, git rebase master. Using rebase will involve two steps, rebasing and then fast-forward merge. If you want to have a linear history then you need to use rebase, but be forewarned that if anybody else has seen your branch commits this may lead to issues that are beyond the scope of this answer. (Notice that in this situation, master and branch-b do NOT point to the same commit. When a three-way merge happens, it creates a commit that has two parents, and also has a commit message. In this case, Git cannot just move the pointer of master from G to E2 because that will get rid of the changes that were made in F and G. You will also not get a chance to edit the merge commit because there is none.Ī three-way merge when your other branch diverges from master (not just ahead): A - B - C - D - E - F - G <-master For example: A - B - C - D <-masterĮxecuting git merge (with default settings) will result in A - B - C - D - E - F - G <- branch-a <-master (There are other versions, but that is not what happened here.) The default behavior is to do a fast-forward merge when possible, and otherwise do a three-way merge.Ī fast-forward merge can take place when the commit that is being merged has the current position of the branch in its history (you can force this behavior with the option -ff-only, which will cause the merge to fail when fast-forward is impossible). Git has two versions of merge: fast-forward and three-way. It looks like the first merge was a fast-forward, and the second one was a three-way merge. How can I keep everything clear without those merge commits that hide/omit the real history of the merged commits? I don't get why I can keep the history from just one of the two branches. ![]() that would reflect more exactly the history of the performed commits. While I would like to obtain something like: **Master** Instead, when I finish work on Branch-B and I try to merge it to master (after that Branch-A has been already merged), I have to specify a commit message for the merging (while for the first branch I have not been asked anything).Īnd after the merging to master, if I type git log, I cannot see the commits of the Branch-B in the history of my master branch And that's fine, if I git log I see all the commits I made on Branch-A. When I finish work on Branch-A, I merge it into master. When I work on two different features (on two different branches created from the master) it is quite annoying that I will not have the commit history when I proceed with merging. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |