Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SQUASH
- Whenever you want to squash last commits in a single commit:-
- first check your log
- `git log`
- ### CASE 1: your head is at the commit in which you want others to be squashed
- count number of commits to be squashed. Let the number of commits be x
- open rebase window using HEAD
- `git rebase -i HEAD~x`
- ### CASE 2: Your head is not at the commit which you want to squash
- Note the SHA commit value of the oldest commit from where you have to start squashing
- open rebase window using SHA value
- `git rebase -i <first 7 alphnumerics of SHA>`
- Follow the instruction and make the changes accordingly
- ## TO SAVE
- press esc key
- type :x!
- press return key
- write your final commit message
- press esc again
- type :wq! or :x!
- press return key
- ## PUSH (if all these extra commits were pushed in GitHub repo also)
- you have to push changes forcefully
- `git push -f origin master`
- replace 'origin' with your remote name and 'master' with your branch name.
- > Squash it up ;)
Add Comment
Please, Sign In to add comment