{"id":470,"date":"2010-09-25T01:16:06","date_gmt":"2010-09-24T23:16:06","guid":{"rendered":"http:\/\/mattiesworld.gotdns.org\/weblog\/2010\/09\/25\/git-set-up-remote-branch-tracking-post-factum\/"},"modified":"2010-09-25T01:16:06","modified_gmt":"2010-09-24T23:16:06","slug":"git-set-up-remote-branch-tracking-post-factum","status":"publish","type":"post","link":"https:\/\/mattiesworld.gotdns.org\/weblog\/2010\/09\/25\/git-set-up-remote-branch-tracking-post-factum\/","title":{"rendered":"Git: set up remote branch tracking post factum"},"content":{"rendered":"<p>I often have the following scenario:<br \/>\n&#8211; create local repository\/branch<br \/>\n&#8211; create gitorious project\/repository<br \/>\n&#8211; push branch to gitorious<\/p>\n<p>This way you end up with your local branch not tracking the remote one. You know you&#8217;re not tracking when you have to specify the branch every time you push\/pull and when you don&#8217;t see how much commits you are ahead of the remote. It is a matter of setting up the correct tracking configuration, something like this for the master branch:<\/p>\n<p><code>git config branch.master.remote origin<br \/>\ngit config branch.master.merge refs\/heads\/master<\/code><\/p>\n<p>However, I just <a href=\"http:\/\/gitready.com\/beginner\/2009\/03\/09\/remote-tracking-branches.html#comment-51116192\">discovered<\/a> that since git 1.7 there is now a command for this:<br \/>\n<code><br \/>\ngit branch --set-upstream master origin\/master<\/code><\/p>\n<p>much easier to remember!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I often have the following scenario: &#8211; create local repository\/branch &#8211; create gitorious project\/repository &#8211; push branch to gitorious This way you end up with your local branch not tracking the remote one. You know you&#8217;re not tracking when you have to specify the branch every time you push\/pull and when you don&#8217;t see how &hellip; <a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/2010\/09\/25\/git-set-up-remote-branch-tracking-post-factum\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Git: set up remote branch tracking post factum<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-470","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/comments?post=470"}],"version-history":[{"count":0,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/470\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/media?parent=470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/categories?post=470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/tags?post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}