{"id":6,"date":"2013-05-04T21:37:58","date_gmt":"2013-05-04T21:37:58","guid":{"rendered":"http:\/\/mobiehl.de\/wordpress\/pc-knowhow\/?p=6"},"modified":"2017-01-05T07:16:32","modified_gmt":"2017-01-05T07:16:32","slug":"git-version-control","status":"publish","type":"post","link":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/2013\/05\/04\/git-version-control\/","title":{"rendered":"GIT version control"},"content":{"rendered":"<h3>Git Schnell\u00fcberblick<\/h3>\n<p><a href=\"https:\/\/rogerdudler.github.io\/git-guide\/index.de.html\">https:\/\/rogerdudler.github.io\/git-guide\/index.de.html<\/a><\/p>\n<h3>Git Book<\/h3>\n<p><a href=\"http:\/\/git-scm.com\/book\/en\/\">http:\/\/git-scm.com\/book\/en\/<\/a><\/p>\n<p><a href=\"http:\/\/git-scm.com\/book\/de\/\">http:\/\/git-scm.com\/book\/de\/<\/a><\/p>\n<h3>GIT &#8211; Version control<\/h3>\n<p><a href=\"http:\/\/www.proggen.org\/doku.php?id=vcs:git:server\" target=\"_blank\">Proggen.org GIT<\/a><\/p>\n<pre><b>Git-Zyklus<\/b><\/pre>\n<p><a href=\"http:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-content\/uploads\/sites\/6\/2013\/05\/git.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-161\" src=\"http:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-content\/uploads\/sites\/6\/2013\/05\/git.jpg\" alt=\"git\" width=\"756\" height=\"530\" srcset=\"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-content\/uploads\/sites\/6\/2013\/05\/git.jpg 756w, https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-content\/uploads\/sites\/6\/2013\/05\/git-300x210.jpg 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><\/p>\n<p><strong>lokal:<\/strong><\/p>\n<p>cd mein_projekt<br \/>\ngit init<\/p>\n<p>git add .<\/p>\n<p>git commit -m &#8216;dummy file&#8217;<br \/>\ngit remote add origin <a href=\"mailto:git@mein-git-server.de\">git@mein-git-server.de<\/a>:mein_projekt.git<br \/>\ngit push origin master:refs\/heads\/master<\/p>\n<p><strong>&#8220;your branch is ahead by&#8230;&#8221;<\/strong> =&gt; You need to push to the remote master. Run <strong>&#8220;git diff origin\/master&#8221;<\/strong> to see what the differences are between your local repository and the remote master repository.<\/p>\n<p><strong>server:<\/strong><\/p>\n<p>cd projectroot<\/p>\n<p>git clone \/srv\/git\/repositories\/&#8221;project&#8221;.git\/<\/p>\n<p><strong>Lokal: entwicklung<\/strong><\/p>\n<p>git push origin master<\/p>\n<p><strong>Server:<\/strong><\/p>\n<p>git pull origin master<\/p>\n<p>Um einen pull r\u00fcckg\u00e4ngig zu machen:<\/p>\n<pre><code>  git reset HEAD@{1}<\/code><\/pre>\n<p><b>Updatezyklus<\/b><\/p>\n<pre><b>Commit<\/b>\r\n$ git commit -m \"Initial commit\" \/\/speichert lokale \u00c4nderungen mit Kommentar \"Init...\r\n$ git commit -a -m \"Improved xy\"  \/\/-a \r\n$ git log  \/\/zeigt alle lokalen commits mit Kommentaren\r\n$ git status  \/\/\u00dcberblick \u00fcber noch nicht commitette \u00c4nderungen am Code<\/pre>\n<pre><b>Checkout<\/b>\r\nhole neuste bzw. letzte eingecheckte Version\r\n$ git checkout -f  \/\/macht die letzten, nichtcommiteten \u00c4nderungen r\u00fcckg\u00e4ngig\r\n$ git status\r\n\r\nzeige alle gespeicherten St\u00e4nde\r\n$ git log\r\n-&gt; liefert alle St\u00e4nde mit Beschreibunge und id\r\n\r\ngehe auf bestimmten Stand\r\n$ git checkout [id]<\/pre>\n<pre>mache alle \u00c4nderungen r\u00fcckg\u00e4ngig und gehe wieder zum Anfang vom aktuellen checkout\r\n$ git checkout .\r\n\r\ngehe zur\u00fcck zum Master\r\n$ git checkout master<\/pre>\n<pre><b>Branch<\/b>\r\nErzeugt neuen Branch mit Namen 'modify-README' \r\n$ git checkout -b modify-README\r\nSwitched to a new branch 'modify-README'\r\n$ git branch<\/pre>\n<pre><b>Edit<\/b>\r\nDateien umbenennen\r\n$ git mv README README.markdown\r\n$ mate README.markdown<\/pre>\n<pre>$ git rm -r  <i>-filename-<\/i><\/pre>\n<pre><b>Merge<\/b>\r\n$ git checkout master\r\nSwitched to branch 'master'\r\n$ git merge modify-README\r\n\r\noptional: delete topic branch\r\n$ git branch -d modify-README<\/pre>\n<pre><b>Global Repository<\/b>\r\nIniales Anlegen\r\n$ git remote add origin \r\n <a href=\"mailto:git@github.com\">git@github.com<\/a>:\/sample_app.git \/\/initiales Anlegen eines remote repositories\r\noder\r\n$ git clone \r\n <a href=\"mailto:git@github.com\">git@github.com<\/a>:\/sample_app.git  \/\/verwende existierendes remote repository<\/pre>\n<pre>$ gi remote -v  \/\/zeigt alle existierenden remote git-locations an<\/pre>\n<pre>$ git pull origin master  \/\/holt letzten Stand vom repository\r\n$ git push origin master  \/\/pushed lokalen master branch nach remote\r\n$ git push origin stable   \/\/pushed lokalen stable branch nach remote<\/pre>\n<h3>Hilfreiche Befehle:<\/h3>\n<p>Git log -p -2<\/p>\n<p>p zeigt, was sich ver\u00e4ndert hat<br \/>\n2 nur die letzten 2 \u00c4nderungen<\/p>\n<p>git log &#8211;pretty=oneline<br \/>\nJeder commit wird nur einzeilig ausgegeben<\/p>\n<p>Autocompletion<br \/>\nhttp:\/\/git-scm.com\/book\/en\/Git-Basics-Tips-and-Tricks<\/p>\n<p>git config &#8211;list<br \/>\nZeige pers. Infos in Konf<\/p>\n<p>Git diff<br \/>\nUm festzustellen, welche \u00c4nderungen du bisher nicht gestaged hast<\/p>\n<p>gitk<br \/>\nGrafische Ausgabe von git log<\/p>\n<p>git checkout -b iss53<br \/>\n:=&gt;<br \/>\n$ git branch iss53<br \/>\n$ git checkout iss53<\/p>\n<p>$ git branch -d hotfix<br \/>\nDeleted branch hotfix (3a0874c).<\/p>\n<p>Branches<\/p>\n<p><img src=\"http:\/\/git-scm.com\/figures\/18333fig0313-tn.png\" alt=\"Branching\" \/><\/p>\n<p><a href=\"http:\/\/de.gitready.com\/beginner\/2009\/01\/21\/pushing-and-pulling.html\" target=\"_blank\">Git Datatransport commands<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>Gitolite<\/h3>\n<p><a href=\"http:\/\/ratgeber-community.com\/einrichtung-eines-git-servers-unter-debian-via-gitolite-2a1b3eed\" target=\"_blank\">Einrichtung-eines-git-servers-unter-debian-via-gitolite<\/a><\/p>\n<div id=\"utility-before-content\"><a href=\"http:\/\/www.bigfastblog.com\/gitolite-installation-step-by-step\" target=\"_blank\">Gitolite Installation Step-By-Step<\/a><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/gitolite.com\/gitolite\/glssh.html\" target=\"_blank\">How gitolite uses ssh<\/a><\/div>\n<h3>Gitosis (veraltet)<\/h3>\n<p><a href=\"http:\/\/www.alphanodes.de\/artikel\/git-repositories-gemeinsam-nutzen\" target=\"_blank\">Git Repositories gemeinsam nutzen<\/a><\/p>\n<p><a href=\"http:\/\/netzaffe.de\/git-gitosis-gitweb-the-debian-way\/neues-repository-hinzufuegen.html\" target=\"_blank\">Gitosis &#8211; the Debian way<\/a><\/p>\n<p><a href=\"http:\/\/git-scm.com\/book\/en\/Git-on-the-Server-Gitosis\" target=\"_blank\">Gitosis &#8211; auf git.com<\/a><\/p>\n<p>Installation im Approot-Verzeichnis (<a href=\"http:\/\/www.railstutorial.org\/chapters\/beginning#sec:version_control\" target=\"_blank\">siehe hier<\/a>)<\/p>\n<p><strong>Deployment<\/strong><\/p>\n<p><strong>server: edit<\/strong><\/p>\n<p>nano \/srv\/git\/repositories\/gitosis-admin.git\/gitosis.conf<\/p>\n<p><strong>enter new project + members:<\/strong><\/p>\n<p>[group planner]<br \/>\nwritable = planner<br \/>\nmembers = <a href=\"mailto:user@email.de\">user@email.de<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git Schnell\u00fcberblick https:\/\/rogerdudler.github.io\/git-guide\/index.de.html Git Book http:\/\/git-scm.com\/book\/en\/ http:\/\/git-scm.com\/book\/de\/ GIT &#8211; Version control Proggen.org GIT Git-Zyklus lokal: cd mein_projekt git init git add . git commit -m &#8216;dummy file&#8217; git remote add origin git@mein-git-server.de:mein_projekt.git git push origin master:refs\/heads\/master &#8220;your branch is ahead by&#8230;&#8221; =&gt; You need to push to the remote master. Run &#8220;git diff origin\/master&#8221; to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/posts\/6"}],"collection":[{"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":20,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/posts\/6\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mobiehl.de\/wordpress\/pc-knowhow\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}