Git command list

Here’s a helpful wiki

  • git init
  • git status
  • touch .gitignore
  • git add .
  • git commit -a
  • git add
  • git branch <? to check available branches
  • git branch [new_branch_name] <? to create a new branch
  • git co [branch]
  • git remote add origin git@github.com:scottmotte/lilruby.git
  • git push origin master
  • git clone
  • git push
  • git pull
  • get pull origin [branch name]
  • git fetch / git merge <? basically git pull combined
  • git diff master human <? see the human changes that will be added to master
  • git diff master human | mate <? pipes it to text editor
  • git branch -d [branch name] <? deletes a branch

For merging

  1. git co master <?go into the branch you want to merge into
  2. (use the other branch to pull the changes you made on that other branch into master)
  3. git merge human <? then just do git merge [branch name]

For rebasing 1. git co master <? go into the branch you want to rebase into 2. (use the other branch to pull the changes you made on that other branch (your name e.g. ryan or scott into master) 3. git rebase scott <? then just do git rebase [branch name]

For pulling Pulling is also a merge so make sure you are on the master when you are pulling something in.

For conflicts git diff

.gitignore file

These are some of the things I usually like to ignore:

  • .DS_Store
  • index/*
  • public/attachments/*
  • log/*.log

deleting a branch on github Stop tracking a remote branch git branch -d -r origin/< remote branch name >

from here: link

Comments