forked from swcarpentry/git-novice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference.html
166 lines (164 loc) · 10.2 KB
/
reference.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Software Carpentry: Version Control with Git</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="alternate" type="application/rss+xml" title="Software Carpentry Blog" href="http://software-carpentry.org/feed.xml"/>
<meta charset="UTF-8" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="lesson">
<div class="container card">
<div class="banner">
<a href="http://software-carpentry.org" title="Software Carpentry">
<img alt="Software Carpentry banner" src="img/software-carpentry-banner.png" />
</a>
</div>
<article>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<a href="index.html"><h1 class="title">Version Control with Git</h1></a>
<h2 class="subtitle">Reference</h2>
<h2 id="git-cheatsheets-for-quick-reference">Git Cheatsheets for Quick Reference</h2>
<ul>
<li>A great <a href="https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf">printable git cheatsheet</a> is available in PDF from the GitHub training website.</li>
<li>An <a href="http://ndpsoftware.com/git-cheatsheet.html">interactive one-page visualisation</a> about the relationships between workspace, staging area, local repository, upstream repository, and the commands associated with each (with explanations).</li>
<li>Both resources are also available in other languages e.g. Spanish, French, and more</li>
</ul>
<h2 id="setting-up-git"><a href="02-setup.html">Setting Up Git</a></h2>
<ul>
<li>Use <code>git config</code> to configure a user name, email address, editor, and other preferences once per machine.</li>
</ul>
<h2 id="creating-a-repository"><a href="03-create.html">Creating a Repository</a></h2>
<ul>
<li><code>git init</code> initializes a repository.</li>
</ul>
<h2 id="tracking-changes"><a href="04-changes.html">Tracking Changes</a></h2>
<ul>
<li><code>git status</code> shows the status of a repository.</li>
<li>Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).</li>
<li><code>git add</code> puts files in the staging area.</li>
<li><code>git commit</code> saves the staged content as a new commit in the local repository.</li>
<li>Always write a log message when committing changes.</li>
</ul>
<h2 id="exploring-history"><a href="05-history.html">Exploring History</a></h2>
<ul>
<li><code>git diff</code> displays differences between commits.</li>
<li><code>git checkout</code> recovers old versions of files.</li>
</ul>
<h2 id="ignoring-things"><a href="06-ignore.html">Ignoring Things</a></h2>
<ul>
<li>The <code>.gitignore</code> file tells Git what files to ignore.</li>
</ul>
<h2 id="remotes-in-github"><a href="07-github.html">Remotes in GitHub</a></h2>
<ul>
<li>A local Git repository can be connected to one or more remote repositories.</li>
<li>Use the HTTPS protocol to connect to remote repositories until you have learned how to set up SSH.</li>
<li><code>git push</code> copies changes from a local repository to a remote repository.</li>
<li><code>git pull</code> copies changes from a remote repository to a local repository.</li>
</ul>
<h2 id="collaborating"><a href="08-collab.html">Collaborating</a></h2>
<ul>
<li><code>git clone</code> copies a remote repository to create a local repository with a remote called <code>origin</code> automatically set up.</li>
</ul>
<h2 id="conflicts"><a href="09-conflict.html">Conflicts</a></h2>
<ul>
<li>Conflicts occur when two or more people change the same file(s) at the same time.</li>
<li>The version control system does not allow people to blindly overwrite each other’s changes. Instead, it highlights conflicts so that they can be resolved.</li>
</ul>
<h2 id="open-science"><a href="10-open.html">Open Science</a></h2>
<ul>
<li>Open scientific work is more useful and more highly cited than closed.</li>
</ul>
<h2 id="licensing"><a href="11-licensing.html">Licensing</a></h2>
<ul>
<li>People who incorporate GPL’d software into their own software must make their software also open under the GPL license; most other open licenses do not require this.</li>
<li>The Creative Commons family of licenses allow people to mix and match requirements and restrictions on attribution, creation of derivative works, further sharing, and commercialization.</li>
<li>People who are not lawyers should not try to write licenses from scratch.</li>
</ul>
<h2 id="hosting"><a href="13-hosting.html">Hosting</a></h2>
<ul>
<li>Projects can be hosted on university servers, on personal domains, or on public forges.</li>
<li>Rules regarding intellectual property and storage of sensitive information apply no matter where code and data are hosted.</li>
</ul>
<h2 id="glossary">Glossary</h2>
<dl>
<dt><span id="change-set">change set</span></dt>
<dd>A group of changes to one or more files that are or will be added to a single <a href="#commit">commit</a> in a <a href="#version-control">version control</a> <a href="#repository">repository</a>.
</dd>
<dt><span id="commit">commit</span></dt>
<dd>To record the current state of a set of files (a <a href="#change-set">change set</a>) in a <a href="#version-control">version control</a> <a href="#repository">repository</a>. As a noun, the result of commiting, i.e. a recorded change set in a repository. If a commit contains changes to multiple files, all of the changes are recorded together.
</dd>
<dt><span id="conflict">conflict</span></dt>
<dd>A change made by one user of a <a href="#version-control">version control system</a> that is incompatible with changes made by other users. Helping users <a href="#resolve">resolve</a> conflicts is one of version control’s major tasks.
</dd>
<dt><span id="http">HTTP</span></dt>
<dd>The Hypertext Transfer <a href="#protocol">Protocol</a> used for sharing web pages and other data on the World Wide Web.
</dd>
<dt><span id="infective-license">infective license</span></dt>
<dd>A license, such as the <a href="http://opensource.org/licenses/GPL-3.0">GPL</a>, that legally requires people who incorporate material under the infective license into their own work to also release under the same infective license (eg. under the GPL license).
</dd>
<dt><span id="merge">merge</span></dt>
<dd>(a repository): To reconcile two sets of changes to a <a href="#repository">repository</a>.
</dd>
<dt><span id="protocol">protocol</span></dt>
<dd>A set of rules that define how one computer communicates with another. Common protocols on the Internet include <a href="#http">HTTP</a> and <a href="#ssh">SSH</a>.
</dd>
<dt><span id="remote">remote</span></dt>
<dd>(of a repository) A version control <a href="#repository">repository</a> connected to another, in such way that both can be kept in sync exchanging <a href="#commit">commits</a>.
</dd>
<dt><span id="repository">repository</span></dt>
<dd>A storage area where a <a href="#version-control">version control</a> system stores the full history of <a href="#commit">commits</a> of a project and information about who changed what, when.
</dd>
<dt><span id="resolve">resolve</span></dt>
<dd>To eliminate the <a href="#conflict">conflicts</a> between two or more incompatible changes to a file or set of files being managed by a <a href="#version-control">version control</a> system.
</dd>
<dt><span id="revision">revision</span></dt>
<dd>A synonym for <a href="#commit">commit</a>.
</dd>
<dt><span id="sha-1">SHA-1</span></dt>
<dd><a href="http://en.wikipedia.org/wiki/SHA-1">SHA-1 hashes</a> is what Git uses to compute identifiers, including for commits. To compute these, Git uses not only the actual change of a commit, but also its metadata (such as date, author, message), including the identifiers of all commits of preceding changes. This makes Git commit IDs virtually unique. I.e., the likelihood that two commits made independently, even of the same change, receive the same ID is exceedingly small.
</dd>
<dt><span id="ssh">SSH</span></dt>
<dd>The Secure Shell <a href="#protocol">protocol</a> used for secure communication between computers.
</dd>
<dt><span id="timestamp">timestamp</span></dt>
<dd>A record of when a particular event occurred.
</dd>
<dt><span id="version-control">version control</span></dt>
<dd>A tool for managing changes to a set of files. Each set of changes creates a new <a href="#commit">commit</a> of the files; the version control system allows users to recover old commits reliably, and helps manage conflicting changes made by different users.
</dd>
</dl>
</div>
</div>
</article>
<div class="footer">
<a class="label swc-blue-bg" href="http://software-carpentry.org">Software Carpentry</a>
<a class="label swc-blue-bg" href="https://github.com/swcarpentry/git-novice">Source</a>
<a class="label swc-blue-bg" href="mailto:admin@software-carpentry.org">Contact</a>
<a class="label swc-blue-bg" href="LICENSE.html">License</a>
</div>
</div>
<!-- Javascript placed at the end of the document so the pages load faster -->
<script src="http://software-carpentry.org/v5/js/jquery-1.9.1.min.js"></script>
<script src="css/bootstrap/bootstrap-js/bootstrap.js"></script>
<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-37305346-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>