Changes between Version 78 and Version 79 of WorkingWithGit


Ignore:
Timestamp:
Jun 22, 2017, 1:40:55 PM (7 years ago)
Author:
raimue (Rainer Müller)
Comment:

Rework instructions for PRs

Legend:

Unmodified
Added
Removed
Modified
  • WorkingWithGit

    v78 v79  
    248248This section describes how to work on a PR without the need to clone or pull from the PR author's repository.
    249249
     250==== 1. Check out the pull request locally
     251
    250252Check out - according to [https://help.github.com/articles/checking-out-pull-requests-locally/ GitHub's help] - the pull request {{{#ID}}} to work on as a local branch:{{{BRANCHNAME}}}:
    251253{{{
     
    258260 | git am
    259261}}}
    260 then pull in changes from upstream, work on it (if required), commit and push to e.g. {{{upstream}}} (i.e. in case the work is ready for production):
     262or a wrapper script such as hub
     263{{{
     264hub am https://github.com/macports/macports-ports/pull/<ID>
     265}}}
     266
     267Put the proposed changes on top of the current upstream/master:
    261268{{{
    262269# --rebase option only needed if branch.autosetuprebase not set accordingly
    263270git pull --rebase upstream master
    264 
     271}}}
     272
     273==== 2. Test changes and modify commits
     274
     275Work on the changes if required and commit your modifications.
     276
     277{{{
     278# add changes to the latest commit
     279git add Portfile
     280git commit --amend
    265281# in case multiple commits have to be edited use
    266282git rebase -i
    267 
    268 # if missing append "Closes: #ID" to commit messages so that GitHub's PR gets auto-closed
     283}}}
     284
     285==== 3. Publish changes
     286
     287===== a) Update PR with your changes
     288
     289For this you have to find the source GitHub repository and branch the PR was created from. You can usually identify this on the GitHub web interface:
     290
     291{{{
     292PR_AUTHOR wants to merge 1 commit into macports:master from PR_AUTHOR:PR_BRANCH
     293}}}
     294
     295Use this information to update the PR by pushing your changes, where `$BRANCHNAME` is the name of the branch you are currently working on:
     296
     297{{{
     298git push https://github.com/$PR_AUTHOR/macports-ports $BRANCHNAME:$PR_BRANCH
     299}}}
     300
     301===== b) Close PR and merge changes to upstream/master
     302
     303{{{
     304# append "Closes: #ID" to the commit messages so that GitHub's PR gets auto-closed
    269305git commit --amend
    270306