Squash all my commits into one for GitHub pull request
This question already has an answer here:
Just a simple addition to help someone else looking for this solution. You can pass in the number of previous commits you would like to squash. for example,
git rebase -i HEAD~3
This will bring up the last 3 commits in the editor.
ok I figured it out ... First I had to write git rebase -i xxxxxxxxxxxxxxxx
where xxxxxxxxxx is the SHA of the commit upto which I've to squash. Then in Notepad I edited the first as pick and rest of all as squash. Then a new notepad window will come and there in the first line I typed the name of my new commit. And then I had to do a force push :
git push --force origin master
Try git rebase -i
, and use 'squash' for all the commits you want to squash.
Edit:
git rebase -i
will show you an interactive editor with the list of commits you are rebasing. The default command before each commit is "pick", so you just need to s/pick/squash/ for all the commits you want to squash, and then all of them will be squash into their last previous commit.
Make sure you are rebasing on a correct branch.
链接地址: http://www.djcxy.com/p/18084.html上一篇: 使用freebase命名实体识别