git checkout a specific commit
To checkout a specific commit in git
git checkout -b <new branch name> <SHA1 commit number>
For example
git checkout -b release-3.16.3-022cbb7552e 022cbb7552e
To checkout a specific commit in git
git checkout -b <new branch name> <SHA1 commit number>
For example
git checkout -b release-3.16.3-022cbb7552e 022cbb7552e
git bisect – Isolating a broken commit
git bisect start # Mark current commit as bad git bisect bad # Set the first good commit - the start of the bisect commit set git bisect good some-commit-here .. compile and run tests ... # Mark the current commit as either bad or good # Git will automatically apply the next subset of commits if bad git bisect good / bad # Done bisecting - we found the bad commit git bisect reset
Git comes with a simple GUI tool – gitk – that does for many.
GitX is a nice OS X-only GUI
To specify a default editor for git commands (that require one) In ~/.gitconfig
[core] editor = "vi"
To specify Texmate
[core] editor = "mate -w"
If you want to refer to a specific stash from a list similar to the one below:
stash@{0}: On release-3.10.0-captcha_service: Captcha service integration
stash@{1}: On release-3.11.0: 3.11 login cookie and widget support changes
stash@{2}: On master: 3.11 Walkthrough
use the full name of the stash.
git stash apply stash@{2}
If not specified, the default is stash@{0}
(From github setup)
git config –global user.email someone@email.com
mkdir ruby19-norubygems
cd ruby19-norubygems
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin git@github.com:tflynn/ruby19-norubygems.git
git push origin master
cd existing_git_repo
git remote add origin git@github.com:tflynn/ruby19-norubygems.git
git push origin master
To push a new branch to an (established) remote repository
git push origin <new branch name>
Create a remote branch from a local branch
git push origin release-3.10.0:refs/heads/release-3.10.0
To pull a new remote branch into an existing repository
To obtain the new code (in an existing repository)
git checkout –track -b release-3.12.0 origin/release-3.12.0
git pull
To pull from a remote repository branch to a local branch (for the same codebase … )
To move or rename a git branch
git branch -m old_branch new_branch
To delete a (local) git branch
git branch -D branch_name
To delete a remote git branch
git push origin :heads/branch_name
To import a Subversion repository into a (new) Git repository
mkdir the_new_git_repo cd the_new_git_repo git svn init -t tags -b branches -T trunk the_old_repo_svn_url git svn fetch
To pull from a branch on another machine
Global setup:
git config –global user.email github.10.tracyflynn@spamgourmet.com
Next steps:
mkdir testme
cd testme
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin git@github.com:tflynn/testme.git
git push origin master
Existing Git Repo?
cd existing_git_repo
git remote add origin git@github.com:tflynn/testme.git
git push origin master
When you’re done:
Continue