-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_10.html
200 lines (187 loc) · 12.1 KB
/
lab_10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<title>Lab 10 - Git Immersion - Brought to you by EdgeCase</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="screen.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1142510-7']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.hotkeys.js"></script>
<script type="text/javascript" src="UI.js"></script>
</head>
<body data-lab-id="10">
<div id="image_preloader">
<img src="green_circle_blur.png">
<img src="label_blur.png">
<img src="logo_small_blur.png">
<img src="prompt_blur.png">
<img src="pager_blur.png">
</div>
<header id="header">
<a href="index.html" id="home_link">Git Immersion</a>
<nav id="pager">
<a id="arrow_next" class="arrow" href="lab_11.html">Next</a>
<a id="arrow_previous" class="arrow" href="lab_09.html">Previous</a>
<a id="table_of_contents_link" href="#">Table of Contents</a>
<a id="bookmark_link"><span id="bookmark"></span>Bookmark this lab</a>
<a id="edgecase_link" href="http://edgecase.com" target="_blank">EdgeCase</a>
</nav>
<h1 class="lab_title"><em>lab 10</em> History</h1>
<a href="http://edgecase.com" target=_blank" id="other_edgecase_link">EdgeCase</a>
</header>
<div id="main_content">
<h1 class="lab_title"><em>lab 10</em> History</h1>
<h3>Goals</h3>
<ul>
<li>Learn how to view the history of the project.</li>
</ul>
<p>Getting a listing of what changes have been made is the function of the <code>git log</code> command.</p>
<h4>Execute:</h4>
<pre class="instructions">git log</pre>
<p>You should see …</p>
<h4>Output:</h4>
<pre class="sample">$ git log
commit 40543214b69016a1f079a0d95ff88cc7421e9b54
Author: Jim Weirich <jim (at) edgecase.com>
Date: Tue Mar 6 16:12:08 2012 -0500
Added a comment
commit 1b754e9e5d528ed7a7d82c3b380fa2b2faa3ce00
Author: Jim Weirich <jim (at) edgecase.com>
Date: Tue Mar 6 16:12:08 2012 -0500
Added a default value
commit 30534911b25d1fab76d13d269ff6215b4c4acddd
Author: Jim Weirich <jim (at) edgecase.com>
Date: Tue Mar 6 16:12:08 2012 -0500
Using ARGV
commit 3cbf83b6899697985d2b4fcfae9b254ab6d0ddf7
Author: Jim Weirich <jim (at) edgecase.com>
Date: Tue Mar 6 16:12:07 2012 -0500
First Commit
</pre>
<p>Here is a list of all four commits that we have made to the repository so far.</p>
<h2>One Line Histories <em>01</em></h2>
<p>You have a great deal of control over exactly what the <code>log</code> command displays. I like the one line format:</p>
<h4>Execute:</h4>
<pre class="instructions">git log --pretty=oneline</pre>
<p>You should see …</p>
<h4>Output:</h4>
<pre class="sample">$ git log --pretty=oneline
40543214b69016a1f079a0d95ff88cc7421e9b54 Added a comment
1b754e9e5d528ed7a7d82c3b380fa2b2faa3ce00 Added a default value
30534911b25d1fab76d13d269ff6215b4c4acddd Using ARGV
3cbf83b6899697985d2b4fcfae9b254ab6d0ddf7 First Commit
</pre>
<h2>Controlling Which Entries are Displayed <em>02</em></h2>
<p>There are a lot of options for selecting which entries are displayed in the log. Play around with the following options:</p>
<pre class="instructions">git log --pretty=oneline --max-count=2
git log --pretty=oneline --since='5 minutes ago'
git log --pretty=oneline --until='5 minutes ago'
git log --pretty=oneline --author=<your name>
git log --pretty=oneline --all</pre>
<p>See man git-log for all the details.</p>
<h2>Getting Fancy <em>03</em></h2>
<p>Here’s what I use to review the changes made in the last week. I’ll add <code>--author=jim</code> if I only want to see changes I made.</p>
<pre class="instructions">git log --all --pretty=format:"%h %cd %s (%an)" --since='7 days ago'</pre>
<h2>The Ultimate Log Format <em>04</em></h2>
<p>Over time, I’ve decided that I like the following log format for most of my work.</p>
<h4>Execute:</h4>
<pre class="instructions">git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short</pre>
<p>It looks like this:</p>
<h4>Output:</h4>
<pre class="sample">$ git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
* 4054321 2012-03-06 | Added a comment (HEAD, master) [Jim Weirich]
* 1b754e9 2012-03-06 | Added a default value [Jim Weirich]
* 3053491 2012-03-06 | Using ARGV [Jim Weirich]
* 3cbf83b 2012-03-06 | First Commit [Jim Weirich]</pre>
<p>Let’s look at it in detail:</p>
<ul>
<li><code>--pretty="..."</code> defines the format of the output.</li>
<li><code>%h</code> is the abbreviated hash of the commit</li>
<li><code>%d</code> are any decorations on that commit (e.g. branch heads or tags)</li>
<li><code>%ad</code> is the author date</li>
<li><code>%s</code> is the comment</li>
<li><code>%an</code> is the author name</li>
<li><code>--graph</code> informs git to display the commit tree in an <span class="caps">ASCII</span> graph layout</li>
<li><code>--date=short</code> keeps the date format nice and short</li>
</ul>
<p>This is a lot to type every time you want to see the log. Fortunately we will learn about git aliases in the next lab.</p>
<h2>Other Tools <em>05</em></h2>
<p>Both <code>gitx</code> (for Macs) and <code>gitk</code> (any platform) are useful in exploring log history.</p>
</div>
<div id="index">
<h1>Table of Contents</h1>
<div id="show_bookmarks"></div>
<div id="no_bookmarks"></div>
<ul>
<li id="lab_0_link"><a href="index.html"><span> </span>Home Cover Page</a></li>
<li id="lab_1_link" data-lab-id="1"><a href="lab_01.html"><span>1:</span> Setup</a></li>
<li id="lab_2_link" data-lab-id="2"><a href="lab_02.html"><span>2:</span> More Setup</a></li>
<li id="lab_3_link" data-lab-id="3"><a href="lab_03.html"><span>3:</span> Create a Project</a></li>
<li id="lab_4_link" data-lab-id="4"><a href="lab_04.html"><span>4:</span> Checking Status</a></li>
<li id="lab_5_link" data-lab-id="5"><a href="lab_05.html"><span>5:</span> Making Changes</a></li>
<li id="lab_6_link" data-lab-id="6"><a href="lab_06.html"><span>6:</span> Staging Changes</a></li>
<li id="lab_7_link" data-lab-id="7"><a href="lab_07.html"><span>7:</span> Staging and Committing</a></li>
<li id="lab_8_link" data-lab-id="8"><a href="lab_08.html"><span>8:</span> Committing Changes</a></li>
<li id="lab_9_link" data-lab-id="9"><a href="lab_09.html"><span>9:</span> Changes, not Files</a></li>
<li id="lab_10_link" data-lab-id="10"><a href="lab_10.html"><span>10:</span> History</a></li>
<li id="lab_11_link" data-lab-id="11"><a href="lab_11.html"><span>11:</span> Aliases</a></li>
<li id="lab_12_link" data-lab-id="12"><a href="lab_12.html"><span>12:</span> Getting Old Versions</a></li>
<li id="lab_13_link" data-lab-id="13"><a href="lab_13.html"><span>13:</span> Tagging versions</a></li>
<li id="lab_14_link" data-lab-id="14"><a href="lab_14.html"><span>14:</span> Undoing Local Changes (before staging)</a></li>
<li id="lab_15_link" data-lab-id="15"><a href="lab_15.html"><span>15:</span> Undoing Staged Changes (before committing)</a></li>
<li id="lab_16_link" data-lab-id="16"><a href="lab_16.html"><span>16:</span> Undoing Committed Changes</a></li>
<li id="lab_17_link" data-lab-id="17"><a href="lab_17.html"><span>17:</span> Removing Commits from a Branch</a></li>
<li id="lab_18_link" data-lab-id="18"><a href="lab_18.html"><span>18:</span> Remove the oops tag</a></li>
<li id="lab_19_link" data-lab-id="19"><a href="lab_19.html"><span>19:</span> Amending Commits</a></li>
<li id="lab_20_link" data-lab-id="20"><a href="lab_20.html"><span>20:</span> Moving Files</a></li>
<li id="lab_21_link" data-lab-id="21"><a href="lab_21.html"><span>21:</span> More Structure</a></li>
<li id="lab_22_link" data-lab-id="22"><a href="lab_22.html"><span>22:</span> Git Internals: The .git directory</a></li>
<li id="lab_23_link" data-lab-id="23"><a href="lab_23.html"><span>23:</span> Git Internals: Working directly with Git Objects</a></li>
<li id="lab_24_link" data-lab-id="24"><a href="lab_24.html"><span>24:</span> Creating a Branch</a></li>
<li id="lab_25_link" data-lab-id="25"><a href="lab_25.html"><span>25:</span> Navigating Branches</a></li>
<li id="lab_26_link" data-lab-id="26"><a href="lab_26.html"><span>26:</span> Changes in Master</a></li>
<li id="lab_27_link" data-lab-id="27"><a href="lab_27.html"><span>27:</span> Viewing Diverging Branches</a></li>
<li id="lab_28_link" data-lab-id="28"><a href="lab_28.html"><span>28:</span> Merging</a></li>
<li id="lab_29_link" data-lab-id="29"><a href="lab_29.html"><span>29:</span> Creating a Conflict</a></li>
<li id="lab_30_link" data-lab-id="30"><a href="lab_30.html"><span>30:</span> Resolving Conflicts</a></li>
<li id="lab_31_link" data-lab-id="31"><a href="lab_31.html"><span>31:</span> Rebasing VS Merging</a></li>
<li id="lab_32_link" data-lab-id="32"><a href="lab_32.html"><span>32:</span> Resetting the Greet Branch</a></li>
<li id="lab_33_link" data-lab-id="33"><a href="lab_33.html"><span>33:</span> Resetting the Master Branch</a></li>
<li id="lab_34_link" data-lab-id="34"><a href="lab_34.html"><span>34:</span> Rebasing</a></li>
<li id="lab_35_link" data-lab-id="35"><a href="lab_35.html"><span>35:</span> Merging Back to Master</a></li>
<li id="lab_36_link" data-lab-id="36"><a href="lab_36.html"><span>36:</span> Multiple Repositories</a></li>
<li id="lab_37_link" data-lab-id="37"><a href="lab_37.html"><span>37:</span> Cloning Repositories</a></li>
<li id="lab_38_link" data-lab-id="38"><a href="lab_38.html"><span>38:</span> Review the Cloned Repository</a></li>
<li id="lab_39_link" data-lab-id="39"><a href="lab_39.html"><span>39:</span> What is Origin?</a></li>
<li id="lab_40_link" data-lab-id="40"><a href="lab_40.html"><span>40:</span> Remote Branches</a></li>
<li id="lab_41_link" data-lab-id="41"><a href="lab_41.html"><span>41:</span> Change the Original Repository</a></li>
<li id="lab_42_link" data-lab-id="42"><a href="lab_42.html"><span>42:</span> Fetching Changes</a></li>
<li id="lab_43_link" data-lab-id="43"><a href="lab_43.html"><span>43:</span> Merging Pulled Changes</a></li>
<li id="lab_44_link" data-lab-id="44"><a href="lab_44.html"><span>44:</span> Pulling Changes</a></li>
<li id="lab_45_link" data-lab-id="45"><a href="lab_45.html"><span>45:</span> Adding a Tracking Branch</a></li>
<li id="lab_46_link" data-lab-id="46"><a href="lab_46.html"><span>46:</span> Bare Repositories</a></li>
<li id="lab_47_link" data-lab-id="47"><a href="lab_47.html"><span>47:</span> Adding a Remote Repository</a></li>
<li id="lab_48_link" data-lab-id="48"><a href="lab_48.html"><span>48:</span> Pushing a Change</a></li>
<li id="lab_49_link" data-lab-id="49"><a href="lab_49.html"><span>49:</span> Pulling Shared Changes</a></li>
<li id="lab_50_link" data-lab-id="50"><a href="lab_50.html"><span>50:</span> Hosting your Git Repositories</a></li>
<li id="lab_51_link" data-lab-id="51"><a href="lab_51.html"><span>51:</span> Sharing Repos</a></li>
<li id="lab_52_link" data-lab-id="52"><a href="lab_52.html"><span>52:</span> Advanced / Future Topics</a></li>
<li id="lab_53_link" data-lab-id="53"><a href="lab_53.html"><span>53:</span> Thank You</a></li>
</ul>
</div>
<div id="cover"></div>
</body>
</html>