{"id":92,"date":"2010-05-10T10:01:00","date_gmt":"2010-05-10T10:01:00","guid":{"rendered":"http:\/\/antynet.pl\/index.php\/2010\/05\/10\/git\/"},"modified":"2010-08-25T23:24:00","modified_gmt":"2010-08-25T21:24:00","slug":"git","status":"publish","type":"post","link":"https:\/\/www.antynet.pl\/index.php\/2010\/05\/10\/git\/","title":{"rendered":"Git"},"content":{"rendered":"<p>Postanowi\u0142em przedstawi\u0107 kilka u\u017cytecznych komend systemu kontroli wersji GIT<\/p>\n<p><strong>ustawienia:<\/strong><br \/>\ngit config &#8211;list<br \/>\ngit config &#8211;global user.name &#8222;dupa jas&#8221;<br \/>\ngit config &#8211;global user.email fdsf@das.pl<br \/>\ngit config &#8211;global core.editor vim<br \/>\ngit config &#8211;global merge.tool diff<\/p>\n<p>git help command<br \/>\nman git-command<br \/>\ngit status<\/p>\n<p>git init         #create git structure in .git directory<\/p>\n<p><strong>podstawowe komendy:<\/strong><br \/>\ngit add . #dodaje wszystkie pliki bie\u017c\u0105cego katalogu do \u015bledzenia<br \/>\ngit rm file #usuwanie pliku<br \/>\ngit mv file1 file2 #przeniesienie<br \/>\ngit commit -a m &#8222;comment&#8221;  #commit zmian z pomini\u0119ciem warstwy stage<br \/>\ngit commit -v #pokazuje zmiany do commit-a<br \/>\ngit commit &#8211;amend<\/p>\n<p><strong>branchowanie:<\/strong><br \/>\ngit branch -a #lista branchy, bie\u017c\u0105cy oznaczony gwiazdk\u0105<br \/>\ngit branch [branch_name] #tworzy nowy branch<br \/>\ngit checkout [branch_name] #przechodzi do branch-a<br \/>\ngit checkout -b [branch_name] #tworzy i przechodzi do branch-a<br \/>\ngit checkout &#8212; [file]<br \/>\ngit branch [branch_name] [hash|tag] #nowy branch utworzony z hash-a lub tag-a<br \/>\ngit branch -d [branch_name] #usuwa branch<br \/>\ngit branch &#8211;merged<br \/>\ngit branch &#8211;no-merged<\/p>\n<p><strong>logi:<\/strong><br \/>\ngit log<br \/>\ngit log -1 #pokazuje ostatni commit<br \/>\ngit log -p -2 #pokazuje r\u00f3\u017cnice mi\u0119dzy dwoma ostatnimi commit-ami<br \/>\ngit log &#8211;pretty=oneline|short|medium|full|fuller|email<br \/>\ngit log &#8211;pretty=format:&#8221;%h &#8211; %an, %ar : %s&#8221;<br \/>\ngit log &#8211;pretty=format:&#8221;%h %s&#8221; &#8211;graph<br \/>\ngit log &#8211;merged #tylko merged commit<\/p>\n<p><strong>r\u00f3\u017cnice:<\/strong><br \/>\ngit diff #r\u00f3\u017cnice mi\u0119dzy warstw\u0105 tzw. &#8222;working directory&#8221; i &#8222;staged&#8221;<br \/>\ngit diff &#8211;staged  #r\u00f3\u017cnice mi\u0119dzy warstw\u0105 &#8222;stage&#8221; i ostatnim commit-em<br \/>\ngit diff &#8211;cached<\/p>\n<p><strong>tagowanie:<\/strong><br \/>\ngit tag #pokazuje tag-i<br \/>\ngit tag -a v1 -m 'comment&#8217;  #dodanie taga<br \/>\ngit show v1<br \/>\ngit tag -a v1.1 [hash] #tagowanie starych commit-\u00f3w<\/p>\n<p><strong>pozosta\u0142e:<\/strong><br \/>\ngit merge [branch_name] #do bie\u017c\u0105cego branch-a merguje zmiany z branch-a [branch_name]<br \/>\ngit ls-files &#8211;stage #pokazuje pliki z warstwy &#8222;stage&#8221;<br \/>\ngit hash-object [file] #tworzy SHA1 hash dla pliku [file]<br \/>\ngit mergetool #wyb\u00f3r na\u017c\u0119dzia do mergowania<br \/>\n.gitignore #lista ignorowanych plik\u00f3w<\/p>\n<p><strong>praca zdalna:<\/strong><br \/>\n<strong>inicjalizacja projektu na serwerze bez &#8222;working directory&#8221;:<\/strong><br \/>\nmkdir project-01.git<br \/>\ncd project-01.git<br \/>\ngit &#8211;bare init<\/p>\n<p><strong>inicjalizacja projektu w lokalnym katalogu:<\/strong><br \/>\ngit init<br \/>\ngit add .<br \/>\ngit commit -m &#8222;initialize project&#8221;<\/p>\n<p><strong>wys\u0142anie na serwer zdalny:<\/strong><br \/>\ngit remote add origin [user]@[server]:\/[path on server to git project dir]<br \/>\ngit push origin master<br \/>\ngit remote -v #sprawdzenie zdalnego serwera<br \/>\ngit remote add [alias] user@server:path\/project.git #dodanie zdalnego repozytorium<br \/>\ngit remote show origin<br \/>\ngit remote rename file1 file2git remote rm file<\/p>\n<p>git clone [url] #klonowanie repozytorium, nie checkout, z pe\u0142n\u0105 histori\u0105<br \/>\ngit clone git:\/\/url [dir_name] #klonowanie z utworzeniem lokalnego katalog dir_name<br \/>\ngit clone http(s):\/\/git clone user@server:\/path<\/p>\n<p>git fetch origin  #pobranie danych z serwera z aliasu &#8222;origin&#8221;, od ostatniego pobrania<br \/>\ngit pull origin #j.w. wraz z mergowaniem<\/p>\n<p>git push origin [branch_name] #wys\u0142anie branch-a branch_name do zdalnego repozytorium<br \/>\ngit push origin [branch_name] [remote_branch_name] #j.w. ze zmian\u0105 nazwy<br \/>\ngit push origin :[branchname] #usuni\u0119cie zdalnego branch-a<\/p>\n<p><strong>schemat warstw:<\/strong><br \/>\nworking dir&#8212;&#8212;-staging area&#8212;&#8212;&#8211;git dir<\/p>\n<p><strong>uk\u0142ad katalog\u00f3w:<\/strong><br \/>\n.git\/objects #all content<br \/>\n.git\/refs #branches<br \/>\n.git\/HEAD #currently checked out<br \/>\n.git\/index #staging area (index)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Postanowi\u0142em przedstawi\u0107 kilka u\u017cytecznych komend systemu kontroli wersji GIT ustawienia: git config &#8211;list git config &#8211;global user.name &#8222;dupa jas&#8221; git config &#8211;global user.email fdsf@das.pl git config &#8211;global core.editor vim git config &#8211;global merge.tool diff git help command man git-command git status git init #create git structure in .git directory podstawowe komendy: git add . #dodaje [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[4],"tags":[9],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-sciaga-admina","tag-linux-git"],"_links":{"self":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":5,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/92\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}