The home for my shortcuts, code snippets, and oft-forgotten directions
www.christinemcclure.comHere's a good cheatsheet.
git clone git@github.com:camcclure/<repo name>
git push origin master
git init
git add .
git commit -m "initial commit"
git remote add origin git@github.com:yourname/<repo name>.git
git push origin master
git branch -D <branch name>
git push origin --delete <branch name>
git branch -a
or:
git fetch
Example: home computer mainly for personal use, sometimes for work use. Set up another account for Galvin login.
Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa Host github-galvin.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_GALVIN
ssh -T git@github-galvin.com
When using the secondary account, only need to use the github alias during the initial clone or add origin:
git remote add origin git@github-galvin.com:galvin/reponame.git git clone git@github-galvin.com:galvin/reponame.git
Always rebase before you start working to start with the latest version
git remote add upstream git@github-cam.com:<master-repo-userName/repoName>.git
Note github-cam to identify correct account.
git checkout master
// on your branch mastergit pull upstream master
// from project remote branch mastergit checkout dev
// on branch devgit rebase master
// on branch dev$ git push origin dev -f
// on branch dev (need to force because now your commit numbers will be off from the rebase)git remote add <branch-name-you-will-use:i.e. 'sam'> git://github-cam.com/<their-username/their-projectName>.git
Note github-cam to identify correct account.
Using sam for this example.
git fetch sam
Will see something like:
* [new branch] dev -> sam/dev * [new branch] gh-pages -> sam/gh-pages * [new branch] master -> sam/master
git checkout -b sam-dev sam/dev
git push origin sam-dev
sam-dev
branch and create a pull request going to your coworker's branch. Make
sure to use the same branch of theirs (dev) that you pulled from.