Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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