Revisions form a GRAPH
import os
top_dir = os.getcwd()
git_dir = os.path.join(top_dir, 'learning_git')
working_dir=os.path.join(git_dir, 'git_example')
os.chdir(working_dir)
%%bash
git log --graph --oneline
* 5f73fff Merge branch ‘master’ of github.com:UCL/github-example
|\
| * 3c4a02f Add another Beacon
* | a5f66ac Add Glyder
|/
* 54a5484 Merge branch ‘master’ of github.com:UCL/github-example
|\
| * b3d5585 Add a beacon
* | b7eba49 Translating from the Welsh
|/
* 4bc25e9 Merge branch ‘master’ of github.com:UCL/github-example
|\
| * aed6a4d Add Scotland
* | d7d7243 Add wales
|/
* 79b1285 Add Helvellyn
* cdd35b8 Include lakes in the scope
* 76322e5 Add lakeland
* e533bb0 Revert “Add a lie about a mountain”
* 972c8ed Change title
* 04ada3b Add a lie about a mountain
* 03915a3 First commit of discourse on UK topography
There are four Separate levels a change can reach in git:
Understanding all the things git reset
can do requires a good
grasp of git theory.
git reset <commit> <filename>
: Reset index and working version of that file to the version in a given commitgit reset --soft <commit>
: Move local repository branch label to that commit, leave working dir and index unchangedgit reset <commit>
: Move local repository and index to commit (“–mixed”)git reset --hard <commit>
: Move local repostiory, index, and working directory copy to that stateNext: Reading - Branches