{"id":125,"date":"2011-07-07T00:58:22","date_gmt":"2011-07-07T00:58:22","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=125"},"modified":"2021-03-24T01:15:04","modified_gmt":"2021-03-24T01:15:04","slug":"git-lesson-branch-is-ahead-by-x-commits","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/git-lesson-branch-is-ahead-by-x-commits\/","title":{"rendered":"Git Lesson : branch is ahead by x commits"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"88\" data-permalink=\"https:\/\/pixert.com\/blog\/git-lesson-branch\/githeader\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?fit=71%2C26&amp;ssl=1\" data-orig-size=\"71,26\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Git\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?fit=71%2C26&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?fit=71%2C26&amp;ssl=1\" class=\"alignleft size-full wp-image-88\" title=\"Git\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?resize=71%2C26\" alt=\"\" width=\"71\" height=\"26\" \/><\/a>\u00a0\u00a0If Git suddenly popup a warning, &#8220;branch is ahead by x commits&#8221;.<\/p>\n<p>You can do the following<\/p>\n<p>Switch to the branch, e.g it&#8217;s the Master branch<\/p>\n<pre class=\"brush: bash; title: Code Block; notranslate\" title=\"Code Block\">git checkout master<\/pre>\n<p>Then, use <strong>Git Fetch<\/strong> to\u00a0update the local copy of a remote branch<\/p>\n<pre class=\"brush: bash; title: Code Block; notranslate\" title=\"Code Block\">git fetch<\/pre>\n<p>Git fetch is similar to pull, except it won&#8217;t do any merging<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0If Git suddenly popup a warning, &#8220;branch is ahead by x commits&#8221;. You can do the following Switch to the branch, e.g it&#8217;s the Master branch git checkout master Then, use Git Fetch to\u00a0update the local copy of a remote branch git fetch Git fetch is similar to pull, except it won&#8217;t do any merging<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[34,35],"tags":[50,10,36,51,52],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-mac-os","category-windows","tag-git","tag-linux","tag-mac-os-2","tag-version-control","tag-windows-2"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-21","jetpack-related-posts":[{"id":82,"url":"https:\/\/pixert.com\/blog\/git-lesson-branch\/","url_meta":{"origin":125,"position":0},"title":"Git lesson : Branch","author":"Pixel Insert \/ Pixert","date":"April 12, 2011","format":false,"excerpt":"What is GIT? Git is... Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access\u2026","rel":"","context":"In &quot;Mac OS&quot;","block_context":{"text":"Mac OS","link":"https:\/\/pixert.com\/blog\/category\/mac-os\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":110,"url":"https:\/\/pixert.com\/blog\/how-to-delete-or-remove-a-local-git-repo-repository\/","url_meta":{"origin":125,"position":1},"title":"How to delete or remove a local Git repo (repository)","author":"Pixel Insert \/ Pixert","date":"May 22, 2011","format":false,"excerpt":"If you want to delete everything (.git folder, files and folders), just delete the whole directory Mac OSX Open Terminal and run the following [bash] rm -rf directoryname [\/bash] Windows Right-click the folder and choose Delete. It will goes to Recycle bin Note: this works for Git Clone and Git\u2026","rel":"","context":"In &quot;Mac OS&quot;","block_context":{"text":"Mac OS","link":"https:\/\/pixert.com\/blog\/category\/mac-os\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/04\/githeader.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":138,"url":"https:\/\/pixert.com\/blog\/mac-clear-terminal-command-history\/","url_meta":{"origin":125,"position":2},"title":"Mac : clear Terminal command history","author":"Pixel Insert \/ Pixert","date":"September 22, 2011","format":false,"excerpt":"[bash] history -c [\/bash]","rel":"","context":"In &quot;Mac OS&quot;","block_context":{"text":"Mac OS","link":"https:\/\/pixert.com\/blog\/category\/mac-os\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":46,"url":"https:\/\/pixert.com\/blog\/change-mamp-mysql-password\/","url_meta":{"origin":125,"position":3},"title":"Change MAMP MySQL password","author":"Pixel Insert \/ Pixert","date":"March 12, 2011","format":false,"excerpt":"MAMP creates a local server environment on Mac OS X by installing Apache, PHP and MySQL right out of the box. The default username\/password for MySQL install is root\/root. That's not safe. For security purposes, in our case we want sync between our WAMP and MAMP , it's best to\u2026","rel":"","context":"In &quot;Mac OS&quot;","block_context":{"text":"Mac OS","link":"https:\/\/pixert.com\/blog\/category\/mac-os\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/mamplogo.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":48,"url":"https:\/\/pixert.com\/blog\/install-magento-at-localhost\/","url_meta":{"origin":125,"position":4},"title":"Install Magento at localhost Windows with WAMP","author":"Pixel Insert \/ Pixert","date":"March 11, 2011","format":false,"excerpt":"Magento is one of the most popular ecommerce platforms available today. Many developer like to build websites, templates and applications on localhost. In this case, we are using WAMP as a server in WINDOWS OS. Magento requires itself to be installed on a host name at least one period '.'\u2026","rel":"","context":"In &quot;Magento&quot;","block_context":{"text":"Magento","link":"https:\/\/pixert.com\/blog\/category\/magento\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/magentologo-300x96.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":27,"url":"https:\/\/pixert.com\/blog\/copy-a-directory-with-its-contents-in-centos\/","url_meta":{"origin":125,"position":5},"title":"Copy a directory with its contents in CentOS","author":"Pixel Insert \/ Pixert","date":"March 6, 2011","format":false,"excerpt":"This command will copy a directory with its content to another directory, for example you have a directory name x, you want to copy it to another directory name y [bash]cp -dpr x[\/bash] or [bash]cp -a x y[\/bash]","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/centos.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}