Monday, June 18, 2012

Working with Github

Here are a few commands I use when working with Github:

Delete a local branch:

First switch to another branch, then:

git branch -D <branch name>

Delete a branch from Github:

git push origin --delete <branch name>

Pushing a branch to Github:

git push origin <branch name>

Updated a branch you forked with changes from the original project:

Track the project and create a tag for it, so you can access it by that tag.
git remote add <tag name> <github url>

Fetch the changes

git fetch <tag name>

Merge the changes from a specified branch

Note: This will merge the changes in the specified branch into whatever branch you're currently on. You can check which branch you're currently on by doing 'git branch'.
git merge <tag name>/<branch name>

Example, pulling from git-extras project:

git remote add git-extras git://github.com/visionmedia/git-extras.git
git fetch git-extras
git merge git-extras/master

No comments:

Post a Comment