begin29
12/2/2015 - 7:18 PM

How to fix pull request?

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