Changes

Jump to navigation Jump to search
2,517 bytes added ,  12:41, 8 June 2020
Migrate tutorial from old wiki
* [http://git-scm.com/docs/gittutorial Tutorial]
* [https://git.zom.bi/ Our Gitlab]
=== Commiting on the docker-host ===
use the compact alias <code>git ''username''-commit</code> to commit with your user information.
''git-push'' all the changes often, so collaboration becomes easier.
Please always use useful commit messages.
 
== Basics ==
This is a guide that bsod wrote as a quick overview for the colleagues at work.
 
=== Clone ===
creates a local copy of the repository including all branches (for initial setup)
<code>
git clone http://XXXXXXXXXXXXXXXXXXXXXXX
</code>
=== Update Repository ===
this updates the changes from the origin (gitlab server)
<code>
git pull
</code>
=== Committing Changes ===
In this example you have created a file ("somefolder/somefile") and edited it
<code>
# if the file is new, add the file to be commited
git add somefolder/somefile
# make a commit of the changes
git commit -m "i made some changes to a new file"
</code>
 
if you change this file you don't need the git add command the next time.
 
=== Push committed changes to server ===
unlike svn files are not uploaded to the server on commit. run the following command in order to push code to the server
<code>
git push
</code>
 
=== Status ===
You can check the status of your repostory (list which files have been changed since the last commit)
 
<code>git status</code>
if nothing has been changed
<code>> git status
Auf Branch master
Ihr Branch ist auf dem selben Stand wie 'origin/master'.
nichts zu committen, Arbeitsverzeichnis unverändert</code>
if you did change something which hasn't been commited yet
<code>> git status
Auf Branch master
Ihr Branch ist auf dem selben Stand wie 'origin/master'.
Änderungen, die nicht zum Commit vorgemerkt sind:
(benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
(benutzen Sie "git checkout -- <Datei>...", um die Änderungen im Arbeitsverzeichnis zu verwerfen)
geändert: bind/Dockerfile
keine Änderungen zum Commit vorgemerkt (benutzen Sie "git add" und/oder "git commit -a")</code>
 
=== Branching ===
==== Create a Branch ====
 
a) just create a branch
git branch branchname
 
b) create a branch and switch to it automatically (recommended)
git checkout -b branchname
 
==== Switch to a different Branch ====
switches to another existing branch ("another-branch")
git checkout another-branch
 
==== Delete a branch ====
a) delete a local branch
git branch -d branchname
 
b) delete a remote branch on origin
git push origin :branchname
=== Revert Files ===
sometimes it is necessary to revert files to the status which is in git (because you broke something or edited a file while being in the wrong branch for example)
 
revert a single file
git checkout -- filename
 
revert the whole repository to the status of the last commit.
git reset --hard
[[Category:Documentation]]

Navigation menu