Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Git course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
courses
Git course
Commits
ef5f35f8
Commit
ef5f35f8
authored
9 years ago
by
Vermaat
Browse files
Options
Downloads
Patches
Plain Diff
Update handouts
parent
9392ae2f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
basics/basics_handouts.tex
+2
-0
2 additions, 0 deletions
basics/basics_handouts.tex
merging/merging_handouts.tex
+34
-43
34 additions, 43 deletions
merging/merging_handouts.tex
remotes/remotes_handouts.tex
+18
-45
18 additions, 45 deletions
remotes/remotes_handouts.tex
with
54 additions
and
88 deletions
basics/basics_handouts.tex
+
2
−
0
View file @
ef5f35f8
...
...
@@ -17,6 +17,8 @@ Git Basics practical.
First, create an empty directory and use ``
\texttt
{
git init
}
'' to make a new
repository.
\begin{itemize}
\item
\emph
{
Hint:
}
Use a unique name for the directory, different from your
neighbour (this is convenient later).
\item
\emph
{
Question:
}
How can you see that you are working in a Git
repository?
\end{itemize}
...
...
This diff is collapsed.
Click to expand it.
merging/merging_handouts.tex
+
34
−
43
View file @
ef5f35f8
...
...
@@ -9,65 +9,53 @@
\begin{center}
{
\bf
Git Introduction Course
}
Working with branches in Git
practical.
Combining changes by merging
practical.
\end{center}
\bigskip
\subsubsection*
{
Inspect the commit graph.
}
We'll work from the repository you created in the previous practical.
\begin{itemize}
\item
\emph
{
Question:
}
What is your current branch and what is the hash of
the commit it points to?
\item
\emph
{
Question:
}
What does the commit graph of you repository look
like? Can you draw it on paper?
\end{itemize}
\emph
{
Hint:
}
Use
\texttt
{
git log
}
with the appropriate arguments.
\subsubsection*
{
Setting the stage.
}
In this practical, you'll work with the repository your neighbour created
during the previous practical. We'll refer to this repository as
{
\bf
N
}
, and
to your own repository from the previous practical as
{
\bf
Y
}
.
\bigskip
As an alternative to
\texttt
{
git log
}
, you can also try a graphical viewer
s
uch as
\texttt
{
gitg
}
(installed on the course laptops) or
\texttt
{
gitk
}
.
Clone his or her repository to your local machine. Make sure to do this in a
s
eparate directory
.
\bigskip
\subsubsection*
{
Implement a feature in a new branch.
}
Let's do some real work (e.g., add some documentation to the project).
After you and your neighbour both cloned eachother's repositories:
\begin{enumerate}
\item
Add a new commit to repository
{
\bf
Y
}
on GitLab (so the one your
neighbour just cloned).
\item
Wait for eachother before continuing.
\item
Update your clone of
{
\bf
N
}
with
\texttt
{
git fetch
}
.
\end{enumerate}
\bigskip
Start by creating a branch for your work (give it a descriptive name) and
switch to it.
\begin{itemize}
\item
\emph
{
Question:
}
What branches are there now and what are the commits
they point to?
\end{itemize}
\emph
{
Question:
}
What does the commit graph of your repository look
like? Can you draw it on paper?
\bigskip
Implement your feature (e.g. write documentation) and commit your changes.
\begin{itemize}
\item
\emph
{
Question:
}
What does the commit graph of you repository look
like now?
\end{itemize}
\emph
{
Hint:
}
Use
\texttt
{
git log
}
with the appropriate arguments.
\bigskip
\subsubsection*
{
Merge your feature.
}
Of course we want this nice feature in
o
u
r
\texttt
{
master
}
branch
.
As an alternative to
\texttt
{
git log
}
, you can also try a graphical viewer
such as
\texttt
{
gitg
}
(installed on the course laptops)
or
\texttt
{
gitk
}
.
\bigskip
\begin{itemize}
\item
\emph
{
Question:
}
If you want to merge branch
\texttt
{
B
}
into branch
\texttt
{
A
}
, what should be your current branch?
\end{itemize}
\subsubsection*
{
Fast-forward merging.
}
Of course we want the nice commit your neighbour just made in our
\texttt
{
master
}
branch.
\bigskip
Merge
your feature
branch into
\texttt
{
master
}
.
Merge
the remote
\texttt
{
master
}
branch into
\texttt
{
master
}
.
\begin{itemize}
\item
\emph
{
Question:
}
What does the commit graph of you repository look
...
...
@@ -76,13 +64,8 @@ Merge your feature branch into \texttt{master}.
\bigskip
Since you merged it, you can now delete the feature branch.
\bigskip
\subsubsection*
{
A three-way merge.
}
Unless you were extremely zealous, the last section produced a fast-forward
merge.
The previous section produced a fast-forward merge.
\bigskip
...
...
@@ -92,12 +75,20 @@ merge.
\bigskip
M
anipulate your repository in such a way that
the commit graph contains a
merge commit (created by a three-way merge).
Together with your neighbour, m
anipulate your repository in such a way that
the commit graph contains a
merge commit (created by a three-way merge).
\begin{itemize}
\item
\emph
{
Question:
}
What does the commit graph of you repository look
like now?
\end{itemize}
\bigskip
\subsubsection*
{
Resolving a merge conflict.
}
Now do the same thing again (a three-way merge), but in such a way the merge
step will result in a merge conflict. Resolve the conflict in a way you feel
is appropriate.
\end{document}
This diff is collapsed.
Click to expand it.
remotes/remotes_handouts.tex
+
18
−
45
View file @
ef5f35f8
...
...
@@ -20,10 +20,6 @@ Please take the following into account with respect to our GitLab server:
\item
If you don't have an LUMC account, ask us to create a GitLab account
for you and select
{
\em
Standard
}
instead of
{
\em
LDAP
}
on the login
page.
\item
Due to the LUMC firewall, accessing repositories using SSH is only
possible from the LUMC network (and not from the LUMC gast network). As an
alternative, you can always use HTTPS but the downside is that you have to
keep repeating your password.
\item
Our GitLab server is very similar (in fact, it is a clone) to the
popular online GitHub (
\texttt
{
https://github.com
}
) and Bitbucket
(
\texttt
{
https://bitbucket.org
}
) services.
...
...
@@ -32,11 +28,17 @@ Please take the following into account with respect to our GitLab server:
\bigskip
\subsubsection*
{
Add your repository to GitLab.
}
\begin{quote}
(If you don't have a repository on your local machine from the previous
practical, create one now with at least one commit.)
\end{quote}
Now you have a nice repository, of course you want to share it on GitLab.
\bigskip
Go to GitLab (
\texttt
{
https://git.lumc.nl
}
) and create a new project.
Go to GitLab (
\texttt
{
https://git.lumc.nl
}
) and create a new project (use the
same name you used to store your repository locally).
\begin{itemize}
\item
\emph
{
Question:
}
What is the repository URL for your new project?
...
...
@@ -48,7 +50,7 @@ Add the GitLab repository as a remote to your local repository.
\bigskip
Push your
branch(es)
to GitLab.
Push your
commits
to GitLab.
\begin{itemize}
\item
\emph
{
Question:
}
Can you see your repository content in the GitLab web
...
...
@@ -57,54 +59,25 @@ Push your branch(es) to GitLab.
\bigskip
\subsubsection*
{
Clone an existing repository from GitLab.
}
There already are some nice repositories on GitLab! Pick one (e.g., from the
person sitting next to you, or browse the public repositories using the globe
icon in the top right).
\bigskip
Create a local clone of the repository you picked.
\begin{itemize}
\item
\emph
{
Question:
}
In the resulting repository, what remotes and
branches exist?
\end{itemize}
\bigskip
\subsubsection*
{
Create a merge request.
}
If you are interested, here are some additional GitLab features you can
use. Fork an existing project, implement a feature, and submit a merge
request.
\emph
{
Hint:
}
Use
\texttt
{
git push
}
once with the
\texttt
{
-u
}
flag so you can
use the
\texttt
{
git push/pull
}
shortcuts.
\bigskip
Find an interesting project and click the
\emph
{
Fork
}
button. This makes a
copy of the project under your own user, on GitLab.
\subsubsection*
{
More synchronisation.
}
Look for a way to edit a file directly from the GitLab web interface (in your
browser) and do this at least once.
\bigskip
Clone the project (your fork) to your local machine.
Update your local copy of the file with the change you just made (by fetching
and merging).
\bigskip
Create a new branch and implement some feature in it. Make sure to commit
this.
\bigskip
Push your new branch to GitLab (your fork of the project).
\bigskip
If you now go to your GitLab dashboard (homepage), you'll see a green button
to create a merge request. From the merge request, the owner of the original
project can directly merge your changes using only the web interface.
\bigskip
Now make another commit locally and push it to the GitLab server. Verify that
all these changes are now present both on your local machine and on the GitLab
server.
\emph
{
Hint:
}
You can also start a discussion or do some code review inside the
merge request.
\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