Githandson

From Gridkaschool
Revision as of 09:56, 3 September 2014 by BenJones (talk | contribs)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Git Hands-on

All of these exercises should be followed on naf-school01 using your school account

  • cd ~/school/git
  • Configure git
    • git config --global user.name "Your Name"
    • git config --global user.email you.email@domain
  • cat ~/.gitconfig
  • optional extras
    • git config --global color.ui auto # If you like colours!
    • git config --global alias.co checkout
    • git config --global alias.st status
    • git config --global alias.ci commit
    • git config --global core.editor emacs # flame bait
    • git config --global core.edit vim
  • git clone gitolite3@naf-school02:gitlab
  • cd gitlab
  • git status
  • vi ${USER}.txt
    • write something
  • git status # what is updated? Working tree, Index or Repository?
    • git diff
    • git diff HEAD
    • git diff --cached
  • git add ${USER}.txt
    • git status
    • git diff
    • git diff HEAD
    • git diff --cached
  • git commit -m “Add user text file”
    • git status
    • git diff
    • git diff HEAD
    • git diff --cached
  • git push origin master
    • this might not work! Why?
    • tip: what does “git pull --rebase” do?