Home : Programming

Git

Things I do the most using git.

Fetching vs Pulling

git pull = git fetch + git merge, effectively

Github

  • Clone: git clone git@github.com:blippy/tacc.git
  • Pushing back: commit your changes, then: git push. If you get an error message like You can't push to git://github.com/user/repo.git, then you need to edit .git/config so that the url line reads: url = git@github.com:blippy/tacc.git

    Other git hosts to consider: gitorious.org repo.or.cz repopular.com

    External links:
    gh-pages - discussion thread on Google Groups started by me about how to generate web pages for Github. grancher looks like a good solution.
    Status - updates at Github's own site
    Twitter - status messages


    Merging from an experimental (local) branch

    To merge from another branch (e.g. exp) to the current branch: git merge exp

    Then, to delete the exp branch: git branch -d exp


    Patches creation

  • Method 1: git format-patch master --stdout > fix_empty_poster.patch
  • Method 2: git format-patch master
  • Method 3: git diff master

    Remote branches

    To push a non-master branch to a remote repo, do:
      git push  
    For example, if you want to push your local dev branch, do
      git push origin dev
    If you wanted to delete the remote branch, type:
      git push origin :dev

    Reverting

    If you want to undo one or more uncommited files: git checkout FILE1 ...

    Tags

  • Listing tags: git tag
  • Creating tags e.g.: git tag -a v1.4 -m 'version 1.4'
  • Pushing tags upstream: git push --tags
  • Checking out a tag: git checkout $tagname. When you've finished, go back to whatever branch you were working on before: git checkout master
    Author:  Mark Carter
    Created: 13-Nov-2010
    Updated: 23-Nov-2010