![]() ![]() As a little safety measure it does print the starting sha1 so you should be able to restore your old branch if anything goes wrong. I've only tested this a few times, so read it first and make sure you want to run it. Use it from your feature branch by running: TOPIC="$(git branch | grep '\\*' | cut -d ' ' -f2)" \Įcho "Freebaseing $TOPIC onto $NEWBASE, previous sha1 was $PREVSHA1" \ Install it by placing the following alias in your. At the very end, it will allow you to use whatever commit message you like for your newly "freebased" branch. I'm calling it git freebase! It will take your existing messy, unrebasable feature branch and recreate it so that it becomes a new branch with the same name with its commits squashed into one commit and rebased onto the branch you specify (master by default). I have created my own git alias to do exactly this. The branch search is irrelevant and not merged in any way.From master, tag got merged: git merge tag.From tag a git merge -squash db was performed and then all changes were staged and committed in a single commit.When the db feature was ready, a new branch called tag was created in the same commit of master that db has its root.Over time, the master branch deviated from db.Nonetheless, the right one is more compact thanks to -squash. In the following example, the left hand screenshot is the result of qgit and the right hand screenshot is the result of: git log -graph -decorate -pretty=oneline -abbrev-commitīoth screenshots show the same range of commits in the same repository. This wiki explains the procedure in detail. This way, the feature branch will contain only one commit and the merge will be represented in a short and tidy illustration. Merge the newly created branch into master.Merge into the above using git merge -squash. ![]() Both commands perform the act of merging. The phrasing here is very important, particularly the article 'a' in front of 'merge': 'a merge' is a noun, while 'to merge' is a verb. ![]() Create a new branch from the latest master, commit in the master branch where the feature branch initiated. Its worth noting here that git merge and git merge -squash are closely related, but git merge -squash does not create a merge.Using git merge -squash as the accepted answer suggests does the trick but it will not show the merged branch as actually merged. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |