Help talk:Git

From CECS wiki
Jump to navigation Jump to search

git crash course outline[edit]

git structure
peer to peer vs. central repo
branching
ssh key transfer for getolite
create repo
git init (local only)
git clone URI DIR
add changes / create files
git add .
git add files…
commit to repo
first time: git push origin master
git commit
git push
update repo from remote repo
git update
git pull
check status, view changes
git status
git diff
git diff --cached
windows git gui
conflict resolution
git fetch instead of pull?
git diff / git diff --cached
git mergetool (kdiff3 emerge meld)

versioning[edit]

list versions
git log
git reflog
git log --abbrev-commit --pretty=oneline
view old changes
git show (commit#)
git show master@{yesterday}
git show HEAD~3
show what is going to be pushed
git log origin/master..HEAD
checkout old versions
naming versions
git commit / git tag -a label
git ignore

identification[edit]

git config --global user.name 'Your Name'
git config --global user.email you@somedomain.com

additional information[edit]

Possible helpers for merge / check (bold have been lightly tested)

  • meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff

initializing a blank repo[edit]

(test these more)

  • remote add origin git@newton.i2lab.ucf.edu:reponame
  • git push
  • git push origin master
  • edit .git/config and clean up if necessary

git branch tutorial[edit]

Excerpted from http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

  • git checkout -b newbranch

(make some changes)

  • git commit -a to add your changes to the branch
  • git checkout master to switch to master
  • git merge newbranch
  • git branch -d newbranch

misc commands[edit]

  • git ls-files
  • git remote -v
  • git config interesting values:
    • core.editor vi
    • user.email / user.name
  • using git with MSword files
  • git config --global alias.wdiff "diff --color-words"

conflict resolution[edit]

  • git config --global merge.tool meld
    • other options: kdiff3 p4merge meld tig(terminal) diffmerge vimdiff
  • git config --global merge.conflictstyle diff3
  • git mergetool