[pytest-dev] maintaining a synced git fork easily?

Florian Bruhin me at the-compiler.org
Mon Sep 28 12:25:58 CEST 2015


* holger krekel <holger at merlinux.eu> [2015-09-28 10:15:27 +0000]:
> How are you solving this usage issue?

I usually have the following workflow when I contribute to projects:

- Fork the upstream library on GitHub, so there's a
  The-Compiler/pytest

- Clone the forked repository. This will have an 'origin' remote (as
  the default remote) which is something like
  git at github.com:The-Compiler/pytest.git

- Add a new remote, 'upstream' with the original, upstream
  repository. I usually use the https URL so I notice if I somehow
  manage to push there accidentally (because there's a password
  prompt):

  $ git remote add upstream https://github.com/pytest-dev/pytest.git

- I always keep my master in sync with the upstream master, by doing
  something like this before working on a new feature (on the master
  branch);

  $ git pull upstream master
  $ git push origin master

  (s/master/features/ as appropriate)

- Create a branch locally, work, and push to fork:

  $ git checkout -b fix-1234
  $ git commit
  $ git push    # (creates the branch on origin, i.e. my fork)

- Commit and push on that branch as necessary to update the PR

- When the PR is merged (assuming to master), clean up the branches
  and update the local and forked master:

  $ git checkout master
  $ git pull upstream master
  $ git push origin master
  $ git branch -d fix-1234
  $ git push origin :fix-1234  # deletes remote branch

I hope that helps!

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20150928/1de270ad/attachment.sig>


More information about the pytest-dev mailing list