Difference between revisions of "Git cheat sheet"

From Simson Garfinkel
Jump to navigationJump to search
m
m
Line 6: Line 6:
==Pull changes==
==Pull changes==
; from a forked repository's upstream:
; from a forked repository's upstream:
  git remote add upstream https://github.com/<<FOOBAR>>
   git fetch upstream        # fetches any new changes from original repository
   git fetch upstream        # fetches any new changes from original repository
   git merge upstream/master  # merges any changes fetched into your working files
   git merge upstream/master  # merges any changes fetched into your working files
Line 12: Line 13:


git pull automatically merges changes. With fetch and merge, the changes are fetched and stored locally, then merged when you request.
git pull automatically merges changes. With fetch and merge, the changes are fetched and stored locally, then merged when you request.
==Differencing==
  git diff HEAD  # should never produce output because HEAD is always the checked out commit
  git diff origin/master # Difference between you and the master
  git log origin/master  # Report what the differences are


==References==
==References==

Revision as of 06:52, 10 April 2013

Make a signed tag and push to github

 git tag -u 'Simson L. Garfinkel <simsong@acm.org>' -s tcpflow-1.2.7 -m 'Release 1.2.7'
 git push --tags


Pull changes

from a forked repository's upstream
 git remote add upstream https://github.com/<<FOOBAR>>
 git fetch upstream        # fetches any new changes from original repository
 git merge upstream/master  # merges any changes fetched into your working files

or

 git pull upstream

git pull automatically merges changes. With fetch and merge, the changes are fetched and stored locally, then merged when you request.

Differencing

  git diff HEAD  # should never produce output because HEAD is always the checked out commit
  git diff origin/master # Difference between you and the master
  git log origin/master  # Report what the differences are

References