Skip to content

Instantly share code, notes, and snippets.

@begin29
Created December 2, 2015 19:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save begin29/6fd14d43d3f36ab505b4 to your computer and use it in GitHub Desktop.
Save begin29/6fd14d43d3f36ab505b4 to your computer and use it in GitHub Desktop.
How to fix pull request?
# I am working on new feature
$ git checkout -b some-new-feature
#Changed files, commit and push to source
git add . && git commit -m 'some cool changes' && git push origin some-new-feature
#After comments within pull request I need to fix some code
#After fix it and commit I can see 2 commits within git history
$ git add . && git commit -m 'some fix to cool changes' && git push origin some-new-feature
$ git log
#=> some cool changes
#=> some fix to cool changes
#I need to squash it on one
$ git rebase -i HEAD~2
#=> I see file oppened in vim
# press `i` for insert mode
# make changes (letter `s` near commit that I want to squash)
# `esc` and `:wq` and `enter`
# after that I will see new file with 2 names "some cool changes" and "some fix to cool changes"
# I put `#` near name that I don't want to see on my result commit
# And `:wq` `enter`
$ git log # => showed me only `some cool changes` if I left it name uncommited
# I need to rewrite remote git repository with squashed commit
# NOTE: You can do it only for `some feature` branches not for branch that somebody also working
$ git push origin some-new-feature -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment