Skip to content

Instantly share code, notes, and snippets.

@TheFern2
Last active April 2, 2020 15:03
Show Gist options
  • Select an option

  • Save TheFern2/12671d16da96c8653a113d89fe2f7ca0 to your computer and use it in GitHub Desktop.

Select an option

Save TheFern2/12671d16da96c8653a113d89fe2f7ca0 to your computer and use it in GitHub Desktop.
Git-Collaboration

Workflow for making a patch git

  • Fetch from master
  • Create branch
  • Fix bugs
  • Run unit tests
  • Rev up version
  • Tags
  • Deleting branches

Fetch from origin or upstream

Forks:

git checkout master
git fetch upstream
git merge upstream/master

OR

Own repos:

git checkout master
git fetch origin
git merge origin/master

Bring feature branch up to date with master

git merge master

Fetch remote branch

git checkout --track origin/my_branch

Clean up fork and update with master

git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force

Create a branch for the fix

git checkout -b "branch-name"

Run unittests in Tests Folder

Run PylogixTests.py unittests, and make sure all tests are passed.

Rev up versions and changelog

  • Update Change log
  • Update init.py version

Commit

git add *
git commit -m "message"
git push origin "branch-name"

Version Tags

NB: Be extremely careful with pushing wrong tag numbers!

git tag v1.0.0
git push origin v1.0.0

After PR is merged push version tag to upstream

git push upstream v1.0.0

Deleting Branches

Once the branch has been merged, it can be safely deleted from local and remote.

$ git push --delete origin <branch_name>
$ git branch -d <branch_name>

The -d will delete once the branch has been merged, if you decided not to merge it or just want to dispose of the branch, use -D to do a forceful deletion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment