Skip to content

Instantly share code, notes, and snippets.

@tmcgilchrist
Created October 8, 2011 01:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcgilchrist/1271705 to your computer and use it in GitHub Desktop.
Save tmcgilchrist/1271705 to your computer and use it in GitHub Desktop.
Personal Git Workflow

Git Workflow

Basic workflow I've been following, inspired by the RailsTutorial website.

Branch -> Edit -> Commit -> Merge -> Push

git init        => Create a new repository in the current directory

git add         => Add file to current changeset.

git add -u      => Add files that may have been locally deleted.

git commit -m "<message>" => Commits the files 'added' to the local repo

git checkout -f => Checkout previous commit overwriting all changes.

git checkout -d <branch_name>  => Checkout and create a branch

git checkout master   => Checkout the main branch

git merge <branch_name>    => Merge branch back into master

Github Specific

  • Create github repo via web

  • Add github repo as origin

    git remote add origin git@github.com:username/project.git

  • Push local repo to github (first time only)

    git push origin master

  • Once you have your local changes commited push to github

    git push

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