(Usage hints for this presentation)
Summer Term 2018
Dr. Jens Lechtenbörger (License Information)
How to collaborate on shared documents as distributed team?
VCS keeps track of history
Git-Intro-Final-1.1.txt
or
Git-Intro-Final-reviewed-Alice.txt
Reference: Pro Git book
“ Git Logo ” by Jason Long under CC BY 3.0; from git-scm.com
Fork/clone repository
Commit (aka check-in)
Branches
“ Git Branches ” by Atlassian under CC BY 2.5 Australia; dimension attributes added, from Atlassian
Prepare answers to the following questions
git init
in any directory
master
branch
master
is not more special than any other branch you may createclone
git clone https://gitlab.com/oer/oer-on-oer-infrastructure.git
git pull
merges changes to bring your copy up to datessh
key pairs (next slide) are used for strong
authentication; register under your account’s settingsssh
): network protocol for remote login with end-to-end
encryption based on
asymmetric cryptography
git clone https://gitlab.com/oer/oer-on-oer-infrastructure.git
oer-on-oer-infrastructure
.git
(with Git meta-data)git status
master
) and potential changesGit-introduction.org
test.txt
git status
again
Git-introduction.org
as not staged and modifiedtest.txt
as untrackedgit add
to stage for commitgit checkout
to discard changesstaged
before commit
git add
is used for that purposegit add Git-introduction.org
git status
Git-introduction.org
as to be committed
and modifiedGit-introduction.org
moregit status
Git-introduction.org
as
git diff
git diff --cached
git add Git-introduction.org
diff
variants again
git help diff
git
commands is availablegit commit -m "<what was improved>"
<what was improved>
should be meaningful textgit status
Git-introduction.org
git push
suggested for follow-upgit log
git reset HEAD~
git status
and git log
git add
with git reset
git add Git-introduction.org
git reset Git-introduction.org
git checkout -- <file>
git stash
git status
and find yourself on previous commitgit pull
git stash apply
git checkout -b testbranch
-b
: Create new branch and switch to itgit status
and find yourself on new branch
master
master
git checkout master
and git checkout testbranch
to
switch branchesgit status
inspects repository, in particular file states
untracked
, if they are located
inside a Git repository but not managed by Gittracked
tracked
files, which states can you identify from
the demo? Which commands are presented to perform what state
transitions?feature
and committed on that
branch; in the meantime, somebody else committed to master
“ A forked commit history ” by Atlassian under CC BY 2.5 Australia; from Atlassian
“ Merging ” by Atlassian under CC BY 2.5 Australia; from Atlassian
feature
branch on master
feature
on master
“ Rebasing ” by Atlassian under CC BY 2.5 Australia; from Atlassian
master
git clone <project-URI> # Then, later on retrieve latest changes: git fetch origin # See what to do, maybe pull when suggested in status output: git status git pull # Create new branch for your work and switch to it: git checkout -b nameForBranch # Modify/add files, commit (potentially often): git add newFile git commit -m "Describe change" # Push branch: git push -u origin nameForBranch # Ultimately, merge or rebase branch nameForBranch into branch master git checkout master git merge nameForBranch # If conflict, resolve as instructed by git, commit. Finally push: git push
README.md
in Markdown syntax
Except where otherwise noted, this work, “Git Introduction”, is © 2018, 2019 by Jens Lechtenbörger, published under the Creative Commons license CC BY-SA 4.0.
In particular, trademark rights are not licensed under this license. Thus, rights concerning third party logos (e.g., on the title slide) and other (trade-) marks (e.g., “Creative Commons” itself) remain with their respective holders.