$EDITOR
git commit
git commit
git init
$EDITOR
git add
git status
git commit
Review status with git status
View changes with git diff
git blame
git branch master
git checkout -b feature
git checkout master
git merge master
git log
commit c0f3b38e959fbd43888ffb0aed52289f0a0fd132 (HEAD -> gh-pages, origin/gh-pages, origin/HEAD)
Author: Eddie Schoute <censored@gmail.com>
Date: Wed Nov 29 12:50:11 2017 -0500
Added .gitignore
commit c0fvev3df94c763d23ec8d41b37a0e9e7e7ef39f
Author: Eddie Schoute <...@gmail.com>
Date: Wed Nov 29 12:49:30 2017 -0500
Added slides for newlines and diff.
git checkout c0fvev3
git pull
git push
git pull
before pushing.
git pull = git fetch + git merge
Uh-oh
animals.md
:
# Favorite animal
Horse
Dolphin
animals.md
:
# Favorite animal
Horse
Chicken
git pull
gives a merge conflict!
git status
:
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: animals.md
no changes added to commit (use "git add" and/or "git commit -a")
animals.md
:
# Favorite Animal
Horse
<<<<<<< HEAD
Dolphin
=======
Chicken
>>>>>>> branch1
Use your editor and fix manually:
# Favorite Animal
Horse
Dolphin
Chicken
Then git add animals.md
git commit
Run "git
" (or git help <command>
)
git <command>
(or just run "git
" for help):
init
: Initialise git repo.status
: Check status of repo. Use often!add
: Add a file to staging (before committing).commit
: Create a commit with your changespull
: Pull changes from a remote repository.push
: Push changes to a remote repository.branch
: Create a branch.merge
: Merge a branch.checkout
: Switch to a branch.Forked from think-git by Dheepak Krishnamurthy