re: Pull Requests: a simple workflow VIEW POST


How does this help?

git reset --soft origin/master

Can you explain?



  • origin is the original project and not your fork.
  • since you have pulled origin/master, that commit represents the latest and greatest that the project has.
  • since you have merged origin/master so that you are not behind the project's latest and greatest. The commit that you did after merging contains the right working tree that you want to submit.
  • after git reset --soft origin/master, when you commit again, you have the exact same right working working tree BUT its direct parent will be origin/master. (1)
  • from the perspective of the maintainer, the git history is clean : exactly one new commit above his master branch.

(1) As the friendly manual says,

  git reset --soft <commit> # here <commit> = origin/master
    Does not touch the index file or the working tree at all 
    (but resets the head to <commit>, just like all modes do). 
    This leaves all your changed files "Changes to be committed", 
    as git status would put it.

Hope that helps :)

Code of Conduct Report abuse