@@ -4,11 +4,70 @@ title: Exploring code and its history
44---
55
66For my own repositories, I like to use [ gitx] ( http://gitx.frim.nl/ ) on
7- my Mac.
7+ my Mac to explore the commit history .
88
99But, of course, you can also just poke around
1010[ github] ( http://github.com ) itself.
1111
1212And you can do a lot of things from the command line, say to look at
1313the combined changes to a file that were made over the last year.
14- See the [ github page about ` git diff ` ] ( http://learn.github.com/p/diff.html ) .
14+ See the
15+ [ github page about ` git diff ` ] ( http://learn.github.com/p/diff.html ) .
16+
17+ ### Tags
18+
19+ Each commit is assigned a &ldquo ; hash tag&rdquo ; which is a unique
20+ sequence of letters and numbers, like
21+ [ 4d9fe11e56652bd19e19e28eac3906f09d5a3074] ( https://github.com/kbroman/github_tutorial/commit/4d9fe11e56652bd19e19e28eac3906f09d5a3074 ) .
22+ When you refer to these hash tags, you can just use an initial substr,
23+ like ` 4d9fe ` , that is unique to your repository.
24+
25+ For my [ R/qtl package] ( http://github.com/kbroman/qtl ) , I like to tag
26+ particular commits by the version number of the package, then I can
27+ use my assigned tag in place of the less memorable hash tag.
28+
29+ To assign a tag, use something like
30+
31+ git tag -a -m "Tagging version 1.28-5" 1.28-5
32+
33+ To push the tags to github, you need to use
34+
35+ git push --tags
36+
37+ To delete a tag, use
38+
39+ git tag -d 1.28-5
40+
41+ and then you need to remove the tag from github
42+
43+ git push origin :refs/tags/1.28-5
44+
45+ ### More uses for diff
46+
47+ To see all of the changes since the last commit, type
48+
49+ git diff
50+
51+ To see all of the changes since a given commit, type
52+
53+ git diff [commit]
54+
55+ Where in place of ` [commit] ` you use the initial part of a hash tag,
56+ like ` 9f4668c ` , or a tag you've created, like ` 1.28-1 ` .
57+
58+ To see all of the changes to a given file since a given commit, type
59+
60+ git diff [commit] [file]
61+
62+ For example,
63+
64+ git diff 1.22-21 R/scanone.R
65+
66+ To see all of the changes between two revisions, type something like
67+
68+ git diff 1.22-21 1.23-16
69+
70+ If you use [ gitx] ( http://gitx.frim.nl/ ) , you can use it to view the
71+ differences using a pipe:
72+
73+ git diff 1.22-21 1.23-16 | gitx
0 commit comments