Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
git-tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Nilsson
git-tutorial
Commits
7c8a691e
Commit
7c8a691e
authored
Mar 20, 2013
by
Administrator
Browse files
Options
Downloads
Patches
Plain Diff
Before showing git diff
parent
846bf870
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
git-tutorial.tex
+70
-2
70 additions, 2 deletions
git-tutorial.tex
with
70 additions
and
2 deletions
git-tutorial.tex
+
70
−
2
View file @
7c8a691e
...
...
@@ -44,6 +44,21 @@ first two reasons listed below:
\label
{
fig:chaos
}
\end{figure}
But why use git instead of cvs, subversion, clearcase, or any other
well-known version control tool?
\begin{itemize}
\item
Git is free, both as in speech and in beer, unlike Clearcase,
Team Foundation andcial systems.
\item
Git is distributed. When each user has her own repository copy
you do not always need to have contact with a central server.
\item
There is a large Internet community around git making it easy to
find information and/or help when needed.
\item
It is used in some large high profile open source projects. Most
known is the Linux kernel.
\end{itemize}
\section
{
Git Tools
}
\label
{
sec:tools
}
...
...
@@ -77,6 +92,7 @@ for versioning your own small projects. Then we will show what happens
when we want to work in a distributed context, cooperating with other
people.
\subsection
{
Standalone Repository
}
\label
{
sec:standalone
}
The simplest use case is that of one single developer, one local
...
...
@@ -100,6 +116,12 @@ following stages as you work on them, see Figure~\ref{fig:lifecycle}:
\label
{
fig:lifecycle
}
\end{figure}
\subsubsection*
{
Help
}
If you wonder what a git command do or which arguments it takes, just
remember that
\verb
|
git help
|
will list the most common git commands
and
\verb
|
git help command
|
will show the git manual for the given
command.
\subsubsection*
{
First time configuration
}
On each computer (or for each user account) you need to tell git your
...
...
@@ -241,7 +263,7 @@ terse, are important as they can be of good use when you or someone
else at some time look back into the revision history and try to find
out what happened and when.
\begin{lstlisting}
andersn@stodola: git commit -am"Initial commit"
andersn@stodola: git commit -a
-
m"Initial commit"
[master (root-commit) c6d834c] Initial commit
3 files changed, 146 insertions(+)
create mode 100644 .gitignore
...
...
@@ -252,6 +274,12 @@ andersn@stodola: git status
# On branch master
nothing to commit (working directory clean)
\end{lstlisting}
A brief explanation of the command options.
\verb
|
-a
|
means that all
modified files will be staged before commit, without it we would only
commit newly added files.
\verb
|
-m
|
says that a revision comment will
follow efter it, without it a text editor (perhaps vi) would start and
allow you to edit a more comprehensive comment.
After performing the first commit, work goes on. New files are added
and existing files are edited. Whenever it feels motivated, add new
...
...
@@ -315,9 +343,46 @@ To stodola.control.lth.se:work/computers/git-tutorial
ebf6fbb..15f6453 master -> master
\end{lstlisting}
\subsection
{
Other useful commands
}
\label
{
sec:other
}
In addition to the above listed git operations, there are a few more
operations that are good to know right from start.
\subsubsection*
{
log
}
\label
{
log
}
\begin{lstlisting}
andersn@stodola: git log
commit 846bf870955b4eae2a5fd7bb6f5071af6b7a9003
Author: Anders Nilsson <andersn@control.lth.se>
Date: Wed Mar 20 09:32:35 2013 +0100
Addded chaos figure and some motivation
commit 95390dea5ea41624953f566fc077c8a8bdbfaf3a
Author: Anders Nilsson <anders@angsro14.se>
Date: Tue Mar 19 23:02:44 2013 +0100
Last changes for tonight
\end{lstlisting}
\verb
|
git log
|
lists all commits in reverse chronological order. In
the example above that the last commits were performed by different
users; myself at home and myself at work.
\subsubsection*
{
diff
}
\label
{
diff
}
\subsubsection*
{
merge
}
\label
{
merge
}
\subsubsection*
{
blame
}
\label
{
blame
}
\section
{
Further Reading
}
\label
{
sec:furtherreading
}
Some useful links:
\begin{itemize}
\item
A cheat sheet is good to print out and have at hand next to your keyboard:
\\
\verb
|
http://git-scm.com/documentation
|
...
...
@@ -327,4 +392,7 @@ To stodola.control.lth.se:work/computers/git-tutorial
online:
\verb
|
http://git-scm.com/book
|
\end{itemize}
In general, Google is your friend, and there are literally hundreds
(if not thousands) of freely available git references, Q
\&
A:s, and
tutorials out there.
\end{document}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment