![]() ![]() This final rebase will graft all commits that are dangling from the feature_acommit (which is now irrelevant as it has been merged into master) right onto master. Git rebase -onto master feature_a feature_b įinally, as soon as feature_a has been merged into master, you simply get the new master and rebase feature_aonto it a last time: git checkout master ![]() Whenever feature_a changes while it is waiting to get merged into master, you rebase feature_b on it. Start your feature_b from feature_a, i.e.: git checkout feature_a Rebasing has been mentioned in other answers, but only for rebasing things onto master. I strongly suggest careful checking of what files are where with what name and content along with testing before pushing these change and concretizing your sin for eternity.For this approach, you do not want to merge your feature_a into feature_b repeatedly. Kind of like a force push except preserving history. I've also used this in "reverse" where I have a magic branch where magic things happen and I want to make the content of the magic branch identical to the donor branch (change the last instance of last variable appearing to the other name, change the merge commit message s/no-change/overwrite/, and ignore the semantics of the names). In the context of the OP, BRANCH_NO_CONTENT_CHANGE is master and BRANCH_PRETENDING_TO_MERGE_FROM is integration. git reset "$(git commit-tree -p "$BRANCH_NO_CONTENT_CHANGE" -p "$BRANCH_PRETENDING_TO_MERGE_FROM" -m "Administrative (no-change) merge of $BRANCH_PRETENDING_TO_MERGE_FROM" "$(git log -n 1 -pretty=format:%T "$BRANCH_NO_CONTENT_CHANGE")")" Note that this command gives you to the power to really mess your life (git history) up, so be careful. There are a number of ways of doing this, but here is one. I won't bore you with my reasons to avoid arguments about version control purity. I'll agree that under almost all circumstances you should not do what the OP is asking, but I do believe that there are times when it does make sense. I haven't tried approach, and it may work fine, but I like my approach because it is less scripty and uses a series of basic commands to achieve the same thing. The -no-edit flag specified to just keep the same commit message. This last command overwrote the current commit (which happens to be the merge commit) using -amend, rather than making a new commit, and because our original commit's file state was in place, git replaced the merge commit's files with our previous commit's files. Now, let's amend the merge commit so it has our original set of files: git commit -amend -no-edit ![]() These changes are our original commit's files, exactly as we want them! Now, if we run git status, we will see that there are staged changes. Now, let's bring back that commit ( 12345abc in this example), without changing the contents of our files, so that our files stay in the same state just as we desire: git reset 12345abc -soft That merge commit is still stored in git's internal history. see git log), we will see that we undid the merge commit and went back to our previous commit. This brings our branch to exactly the same state we started in. Now we will reset our current-branch back to our previous commit from before the merge, so that we get the files back into the state we want: git reset HEAD~ -hard To see the history and copy the hash of the merge commit. Now let's get the commit hash of this new merge commit. Git commit # conclude the merge, don't worry about conflict markers So if we have a conflict, just commit it anyway: git add every thing This assumes we are on current-branch and will merge branch-to-merge into our current branch ( current-branch).Īt this point, if we get a merge conflict, just commit everything including the conflicts without fixing them, it won't matter. After that I only want to "merge" integration on master without to put changes (because already are there). after I split integration from master project structure was modified and now I have to much conflicts.The final question is: How to merge integration in master without to put changes on master, only to affect history (visually)? I want to merge integration into master, only visual (without changes), to look good on history, because I already have changes with that single commit. So master will contain last version of files from integration branch, but integration will remain splitted from master. To reset it, when was splitted from master, because I can saw last changes and put them with one commit on master. This branch contains a lot of changes, and I want to make a trick. ![]() I want to merge integration branch into master, but I don't want to change anything only to look good. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |