My git Cheat Sheet

Posted on April 20, 2010

Create a new branch based on remote branch

$ git checkout –track -b {new_branch} origin/{remote_branch}

To push an branch in to remove branch

$ git pull

$ git push origin {branch}:{remote_branch}

Example:

$git push origin stage34:stage/v3.4

Git add remote branch

git push origin {existed_local_branch}:{new_remote_branch}

Git delete remote branch

git push origin :{remote_branch}

Git create a new remote branch by remote master

git push origin origin:refs/heads/{new_remote_branch}

Fetch only one file
git checkout {file name}

Fetch only one file from remote
git checkout — {file name}