Created by Wen Li / wen.li@ucl.ac.uk
Working Directory: The directory where the normal files are stored
Commit: A snapshot of changes made between two versions
Branch: A sequence of commits representing editing history
Repository: A place (directory) where branches live
Basically can be imagined as a diff file containing changes in multiple files
A series commits that may branch out and be merge with the others.
A place where all branches live, which is named .git
git init
Create a repo with in the project root directorygit checkout -b <branch>
Create a new branch starting from the latest commit (branch out)git add .
Add changes to staging area, i.e., create a snapshot of the changes you have madegit commit -m "your commit message"
Commit the staged changes to repogit tag <name>
Mark a commit with a namegit checkout <branch>
Check out another branch Remote repo is just another .git
directory locating somewhere else.
git clone <URL>
Create a local mirror of the remote repogit remote add <name> <URL>
Add a reference to a remote repogit push <name> <branch>
Upload (synchronize) the current branch to the remote repogit pull <name> <branch>
Download (synchronize) the branch in the remote repo and merge it to the current one
git log
Viewing the history of current branchgit checkout <ref>
Update the working directory to the states of a branch/tag/commitgit revert <ref>
Create a new commit to revert the changes made since ref
git checkout -b <new branch>
Create a new branch from current pointgit merge <branch>
Merge the changes from another branchWhy SmartGit?
git init
git clone <URL> <dir>
git add <filepath>
git commit -m "<description>"
git checkout -b <branch>
git tag <name>
git pull
git push
git checkout -- <filepath>
git revert
Thanks & Questions