Git
1. Squash commits in intellij:
In the Log tab of the Git tool window Alt+9 select the commits that you want to combine into one and choose Squash Commits from the context menu.
In the dialog that opens, edit the commit message (by default, it contains the messages from both commits) and click OK.
Push Ctrl+Shift+K the changes to the remote branch.
2. git rebasing after a large amount of work and many merges:
If the branch you're working on is called my-branch and you want to rebase from master then just do the following:
git checkout my-branch
git branch -m my-branch-old
git checkout master
git checkout -b my-branch
git merge --squash my-branch-old
git commit -m "commit message"
git push origin my-branch -f
3. Work with multiple stashes:
git stash save "stash name"
git stash show stash@{1} => This command shows the summary of the stash diffs
git stash apply stash@{1} => apply stash
git stash pop stash@{1} => This command is very similar to stash apply but it deletes the stash from the stack after it is applied.
git stash list => to show list of stash
git stash branch <name> stash@{1} => This command creates a new branch with the latest stash, and then deletes the latest stash ( like stash pop).
Git stash clear : This command deletes all the stashes made in the repo. It maybe impossible to revert.
git stash drop stash@{1} => This command deletes the latest stash from the stack
Comments
Post a Comment