{"id":1911,"date":"2017-05-09T15:22:17","date_gmt":"2017-05-09T13:22:17","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=1911"},"modified":"2017-05-09T15:56:35","modified_gmt":"2017-05-09T13:56:35","slug":"git-survival-guide","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=1911","title":{"rendered":"Git Survival Guide"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#Configure\"><span class=\"toc_number toc_depth_1\">1<\/span> Configure<\/a><ul><li><a href=\"#Global_user_name_ie_for_every_repository_on_your_computer\"><span class=\"toc_number toc_depth_2\">1.1<\/span> Global user name (i.e. for every repository on your computer)<\/a><\/li><li><a href=\"#Local_user_name_ie_only_for_this_repository\"><span class=\"toc_number toc_depth_2\">1.2<\/span> Local user name (i.e. only for this repository)<\/a><\/li><\/ul><\/li><li><a href=\"#Working_Area\"><span class=\"toc_number toc_depth_1\">2<\/span> Working Area<\/a><ul><li><a href=\"#Clone_repository\"><span class=\"toc_number toc_depth_2\">2.1<\/span> Clone repository<\/a><\/li><li><a href=\"#Init_repository\"><span class=\"toc_number toc_depth_2\">2.2<\/span> Init repository<\/a><\/li><\/ul><\/li><li><a href=\"#Local_actions\"><span class=\"toc_number toc_depth_1\">3<\/span> Local actions<\/a><ul><li><a href=\"#Switch_branch\"><span class=\"toc_number toc_depth_2\">3.1<\/span> Switch branch<\/a><\/li><li><a href=\"#Create_a_new_branch\"><span class=\"toc_number toc_depth_2\">3.2<\/span> Create a new branch<\/a><\/li><\/ul><\/li><li><a href=\"#Publication_server_actions\"><span class=\"toc_number toc_depth_1\">4<\/span> Publication server actions<\/a><ul><li><a href=\"#Clone_repository-2\"><span class=\"toc_number toc_depth_2\">4.1<\/span> Clone repository<\/a><\/li><li><a href=\"#Fetch_repository\"><span class=\"toc_number toc_depth_2\">4.2<\/span> Fetch repository<\/a><\/li><li><a href=\"#Pull_repository\"><span class=\"toc_number toc_depth_2\">4.3<\/span> Pull repository<\/a><\/li><li><a href=\"#Push_repository\"><span class=\"toc_number toc_depth_2\">4.4<\/span> Push repository<\/a><\/li><\/ul><\/li><\/ul><\/div>\n<h1><span id=\"Configure\">Configure<\/span><\/h1>\n<h2><span id=\"Global_user_name_ie_for_every_repository_on_your_computer\">Global user name (i.e. for every repository on your computer)<\/span><\/h2>\n<p>To set the global user name :<\/p>\n<pre lang=\"bash\">\r\n$> git config --global user.name \"John Doe\"\r\n<\/pre>\n<p>To check the global user name :<\/p>\n<pre lang=\"bash\">\r\n$>git config --global user.name\r\nJohn Doe\r\n<\/pre>\n<h2><span id=\"Local_user_name_ie_only_for_this_repository\">Local user name (i.e. only for this repository)<\/span><\/h2>\n<p>To set the local user name :<\/p>\n<pre lang=\"bash\">\r\n$> git config user.name \"John Doe\"\r\n<\/pre>\n<p>To check the local user name :<\/p>\n<pre lang=\"bash\">\r\n$>git config user.name\r\nJohn Doe\r\n<\/pre>\n<h1><span id=\"Working_Area\">Working Area<\/span><\/h1>\n<h2><span id=\"Clone_repository\">Clone repository<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git clone http:\/\/srv-scm\/git\/myrepo.git\r\n<\/pre>\n<h2><span id=\"Init_repository\">Init repository<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git init myrepo\r\nInitialized empty Git repository in \/opt\/git\/myrepo\/.git\/\r\n<\/pre>\n<h1><span id=\"Local_actions\">Local actions<\/span><\/h1>\n<h2><span id=\"Switch_branch\">Switch branch<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git checkout myexistingbranch\r\n<\/pre>\n<h2><span id=\"Create_a_new_branch\">Create a new branch<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git checkout -b newbranch\r\n<\/pre>\n<h1><span id=\"Publication_server_actions\">Publication server actions<\/span><\/h1>\n<h2><span id=\"Clone_repository-2\">Clone repository<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git clone http:\/\/srv-scm\/git\/myrepo.git\r\n<\/pre>\n<h2><span id=\"Fetch_repository\">Fetch repository<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git fetch\r\n<\/pre>\n<h2><span id=\"Pull_repository\">Pull repository<\/span><\/h2>\n<p>git pull = git fetch followed by git merge FETCH_HEAD<\/p>\n<pre lang=\"bash\">\r\n$>git pull\r\n<\/pre>\n<h2><span id=\"Push_repository\">Push repository<\/span><\/h2>\n<pre lang=\"bash\">\r\n$>git push\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 Configure1.1 Global user name (i.e. for every repository on your computer)1.2 Local user name (i.e. only for this repository)2 Working Area2.1 Clone repository2.2 Init repository3 Local actions3.1 Switch branch3.2 Create a new branch4 Publication server actions4.1 Clone repository4.2 Fetch repository4.3 Pull repository4.4 Push repository Configure Global user name (i.e. for every repository on your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1219,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1911","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1911"}],"version-history":[{"count":11,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1911\/revisions"}],"predecessor-version":[{"id":1922,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1911\/revisions\/1922"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1219"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}