{"id":38891,"date":"2016-07-04T11:00:07","date_gmt":"2016-07-04T08:00:07","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=38891"},"modified":"2019-04-23T14:30:00","modified_gmt":"2019-04-23T11:30:00","slug":"git-push-branch-remote-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/","title":{"rendered":"Git Push Branch to Remote Example"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>As we all know, <code>Git<\/code> has been widely used by software developers. It&#8217;s free and open-source. Compared with other Version Control Systems, such as SVN (Apache Subversion) and CVS (Concurrent Version System), <code>Git<\/code> has its own advantages.<\/p>\n<p>Firstly, <code>Git<\/code> is powerful by its distributed nature, fast operation and branch handling mechanism. The distributed property makes it easy and efficient for multiple developers &nbsp;to work together, towards the same project. Also, <code>Git<\/code> works fast with its lightweight operations. Furthermore, every developer can work with the code as its own branch. Others can merge different branches, which makes cooperation-work quite easy.<\/p>\n<p>&nbsp;<br \/>\n<code>Github<\/code> is a web-based <code>Git<\/code> repository. It is also called remote repository, compared to the local repository. It provides web-based GUI and desktop GUI, as well as mobile integration. Also, it provides access control and other features for collaboration. This is very useful for bug tracking, task management and wikis for every project.<\/p>\n<p>For <code>Git<\/code> and <code>Github<\/code>, they do have close connections with each other. We can use different commands to make them connect. For more command options, go to my previous <a href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-tutorial-beginners\/\">Git tutorial<\/a>. You may also need to install <code>Git<\/code> and set up <code>Github<\/code>. For instructions on this, you may refer to my previous article <a href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-clone-repository-example\/\">Git clone repository example<\/a>.<\/p>\n<p>In this article, we will focus more on a very important <code>Git<\/code> command: git push. Also I&#8217;ll show you how to push local project to remote repository: <code>Github<\/code>.<\/p>\n<p>All the examples below is shown in MacOS EI Capitan Version 10.11.5 and the Git version is 2.7.4.<\/p>\n<h2>2. Git push branch to remote example<\/h2>\n<h3>2.1 Git repository<\/h3>\n<p>Before we go to the real command, we need to be familiar with <code>Git<\/code> repository. Below is a flowchart for <code>Git<\/code> with some common <code>Git<\/code> commands.<\/p>\n<p><figure id=\"attachment_36668\" aria-describedby=\"caption-attachment-36668\" style=\"width: 603px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/gitflow.jpg\"><img decoding=\"async\" class=\"wp-image-36668 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/gitflow.jpg\" alt=\"gitflow\" width=\"603\" height=\"524\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/gitflow.jpg 603w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/gitflow-300x261.jpg 300w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/a><figcaption id=\"caption-attachment-36668\" class=\"wp-caption-text\">gitflow<\/figcaption><\/figure><\/p>\n<p>In the figure above, we can see that there&#8217;ll be four different repositories. And we will work a lot with them:<\/p>\n<ul>\n<li><strong>Workspace<\/strong>: it\u2019s the place where you see in your computer system, or the directory where you check out your files. Files in the workspace could be added to the Git by using&nbsp;<code>git add<\/code>&nbsp;command. Basically it could be any folders in your computer.<\/li>\n<li><strong>Index<\/strong>: it\u2019s also called stating area. It\u2019s an invisible space, where you can add files that you want to commit. To add commit, you can use&nbsp;<code>git commit<\/code>&nbsp;command.<\/li>\n<li><strong>Local repository<\/strong>: it\u2019s also an invisible repository. Actually it\u2019s stored in the .git folder, which is hidden in the folder you created.<\/li>\n<li><strong>Remote repository<\/strong>: this could be another computer, or it could be the server of others, such as Github, which we can consider it as a remote repository. To access to the remote repository, git push or&nbsp;<code>git pull<\/code>&nbsp;could be used.<\/li>\n<\/ul>\n<h3>2.2 Basic concepts<\/h3>\n<p>In addition to the <code>Git<\/code> repositories, we also need to have ideas about some other concepts:<\/p>\n<ul>\n<li><strong>Branch<\/strong>: it\u2019s used to create another line of code. Usually it\u2019s for creating another new feature. Once the new feature has been completed, it can be merged back the the master branch.<\/li>\n<li><strong>Master Branch<\/strong>: we can consider it as the main branch\/code to work on. You can add other branches if needed. But the whole project can only have one master branch.<\/li>\n<li><strong>Commit<\/strong>: it holds the current state of the repository. It can be considered as a node of a linked-list. Every commit has a pointer to the parent commit object. You can go back to the parent commit object by changing the pointer.<\/li>\n<li><strong>HEAD<\/strong>: it is the pointer to the most recent commit on the current branch. It\u2019s actually a hash value of current commit, which is calculated by SHA-1 hash on a file with a hash value of 160 bits that uniquely identifies the contents of the file.<\/li>\n<\/ul>\n<h3>2.3 Git clone example<\/h3>\n<p>Then, we can try with a project and see how it works. For example, we try with Datastax java driver for NoSQL database Apache Cassandra. We can get the Github link from here <a href=\"https:\/\/github.com\/datastax\/java-driver\">https:\/\/github.com\/datastax\/java-driver<\/a>. In the figure below we see&nbsp;how it looks for this Git project.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><figure style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/java-driver.jpg\"><img decoding=\"async\" class=\"wp-image-37132 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/java-driver.jpg\" alt=\"java driver\" width=\"860\" height=\"500\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/java-driver.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/java-driver-300x174.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/java-driver-768x447.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption class=\"wp-caption-text\">Github page for Datastax java driver<\/figcaption><\/figure><\/p>\n<p>Then, if you want to download it and work on this project on your local machine, you can use&nbsp;<code>git clone<\/code>&nbsp;command. To do this, you need to find the&nbsp;<code>git<\/code>&nbsp;link for this project. For this project, the&nbsp;<code>git<\/code>&nbsp;link is <a href=\"https:\/\/github.com\/datastax\/java-driver.git.\">https:\/\/github.com\/datastax\/java-driver.git.<\/a> The position of this link is below with blue part marked and you can copy it.<\/p>\n<p><figure style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-link.jpg\"><img decoding=\"async\" class=\"wp-image-37131 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-link.jpg\" alt=\"git link\" width=\"860\" height=\"128\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-link.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-link-300x45.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-link-768x114.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption class=\"wp-caption-text\">Git link for Datastax java driver<\/figcaption><\/figure><\/p>\n<p>After this, open your terminal and go to the position you want to save this project. Type&nbsp;<code>git clone https:\/\/github.com\/datastax\/java-driver.git<\/code>. Then it\u2019ll download this project to your local machine like below:<\/p>\n<p><figure style=\"width: 860px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-clone.jpg\"><img decoding=\"async\" class=\"wp-image-37130 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-clone.jpg\" alt=\"git clone\" width=\"860\" height=\"209\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-clone.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-clone-300x73.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-clone-768x187.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption class=\"wp-caption-text\">Git clone<\/figcaption><\/figure><\/p>\n<p>The <code>git clone<\/code> command will clone all the branches to your local machine. Go inside the folder. You can check all the branches with command <code>git branch -a<\/code> in your terminal like below:<\/p>\n<p><figure id=\"attachment_37663\" aria-describedby=\"caption-attachment-37663\" style=\"width: 748px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-branches-list.jpg\"><img decoding=\"async\" class=\"wp-image-37663 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-branches-list.jpg\" alt=\"git branches list\" width=\"748\" height=\"1280\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-branches-list.jpg 748w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-branches-list-175x300.jpg 175w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/git-branches-list-598x1024.jpg 598w\" sizes=\"(max-width: 748px) 100vw, 748px\" \/><\/a><figcaption id=\"caption-attachment-37663\" class=\"wp-caption-text\">git branches list<\/figcaption><\/figure><\/p>\n<p>In the figure above, you may find out different numbers like 1.0, 2. 0, 3.0 etc. Actually, these are the version name or branches for this project. Here, there&#8217;s a 3.0 with a star * before it. This is the branch in the local repository. remotes means the remote repository. origin is the name for the remote repository and 1.0, 2.0 are the branches inside the remote repository.<\/p>\n<h3>2.4 Git remote<\/h3>\n<p>Furthermore, we can also get the information about origin with command <code>git remote<\/code> and <code>git remote show origin<\/code><\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:java-driver WXM$ git remote\norigin\nWXMs-MacBook-Pro:java-driver WXM$ git remote show origin\n* remote origin\n  Fetch URL: https:\/\/github.com\/datastax\/java-driver.git\n  Push  URL: https:\/\/github.com\/datastax\/java-driver.git\n  HEAD branch: 3.0\n  Remote branches:\n    1.0                             tracked\n    2.0                             tracked\n    2.0.10_fixes                    tracked\n    2.0.9_fixes                     tracked\n    2.1                             tracked\n    2.2                             tracked\n    3.0                             tracked\n    3.0-test-fixes                  tracked\n    3.0.x                           tracked\n    appveyor-enablement             tracked\n    async_pool                      tracked\n    dse_3.1                         tracked\n    gh-pages                        tracked\n    graph                           tracked\n    java1015                        tracked\n    java1020                        tracked\n    java1126                        tracked\n    java1133-rebased-on-java1136    tracked\n    java1153                        tracked\n    java1157                        tracked\n    java1161                        tracked\n    java1180                        tracked\n    java1192                        tracked\n    java1193                        tracked\n    java1196                        tracked\n    java1201                        tracked\n    java1206                        tracked\n    java1212                        new (next fetch will store in remotes\/origin)\n    java1227                        new (next fetch will store in remotes\/origin)\n    java1233                        new (next fetch will store in remotes\/origin)\n    java438                         tracked\n    java541                         tracked\n    java743                         tracked\n    java864                         tracked\n    java905                         tracked\n    java970                         tracked\n    refs\/remotes\/origin\/clirr-fixes stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1175    stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1186    stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1187    stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1198    stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1200    stale (use 'git remote prune' to remove)\n    refs\/remotes\/origin\/java1202    stale (use 'git remote prune' to remove)\n    various-test-fixes-3.0.x        tracked\n  Local branch configured for 'git pull':\n    3.0 merges with remote 3.0\n  Local ref configured for 'git push':\n    3.0 pushes to 3.0 (up to date)\n<\/pre>\n<h3>2.5 Git push branch to remote<\/h3>\n<p>According to the flowchart for <code>Git<\/code>, we know that we can push\/upload our code to remote repository. Here, <code>git push<\/code> is the command that we can use for it. It&#8217;s used for pushing commits made on your local branch to remote repository.[ulp id=&#8217;pzgfvmZhgslwSymm&#8217;]<\/p>\n<p>The <code>git push<\/code> takes two arguments: a remote name, for example origin; a branch name for example, master. The format for this could be:<\/p>\n<pre class=\"brush:bash\">git push REMOTENAME BRANCHNAME\n<\/pre>\n<p>Normally, we work a lot with <code>git push origin master<\/code>. This command pushes the local changes to remote repository.<\/p>\n<p>Firstly, we need to have a new branch to push to the remote. We can create a new branch named newBranch. We can type the command below:<\/p>\n<pre class=\"brush:java\">git branch newBranch\n<\/pre>\n<p>Then a new brach with name newBranch is created. We can check this out with command <code>git branch -a<\/code>. This will list all branches inside this repository. Here I&#8217;ll show you a simple example other than the Datastax java driver. You can find my example in my remote repository with link: <a href=\"https:\/\/github.com\/wuxiaomin98\/GitLearning\">https:\/\/github.com\/wuxiaomin98\/GitLearning<\/a>.<\/p>\n<p>Initially there&#8217;ll only be one master branch for this project. I want to add a new branch to this project. Then I clone it to my local machine with <code>git clone<\/code> command like below:<\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:~ WXM$ git clone https:\/\/github.com\/wuxiaomin98\/GitLearning.git\nCloning into 'GitLearning'...\nremote: Counting objects: 50, done.\nremote: Total 50 (delta 0), reused 0 (delta 0), pack-reused 50\nUnpacking objects: 100% (50\/50), done.\nChecking connectivity... done.\n<\/pre>\n<p>Then you can check the branch with <code>git branch<\/code> command.<\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:~ WXM$ cd GitLearning\/\nWXMs-MacBook-Pro:GitLearning WXM$ git branch\n* master\nWXMs-MacBook-Pro:GitLearning WXM$ git branch -a\n* master\n  remotes\/origin\/HEAD -&gt; origin\/master\n  remotes\/origin\/master\n<\/pre>\n<p>After this you may create a new brach named newBranch like below. In addition, you can list the branches with <code>git branch -a<\/code>.<\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:GitLearning WXM$ git branch newBranch\nWXMs-MacBook-Pro:GitLearning WXM$ git branch -a\n* master\n  newBranch\n  remotes\/origin\/HEAD -&gt; origin\/master\n  remotes\/origin\/master\n<\/pre>\n<p>Here, you should notice that there&#8217;s a newBranch just after the default branch master. Then you can switch to the new brach with command <code>git checkout newBranch<\/code>.<\/p>\n<pre class=\"brush:java\">WXMs-MacBook-Pro:java-driver WXM$ git checkout newBranch\nSwitched to branch 'newBranch'\n<\/pre>\n<p>Right now, you can see the star * before the new branch. After this, you can push the new branch to the remote repository with command <code>git push master newBranch<\/code><\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:GitLearning WXM$ git push origin newBranch\nTotal 0 (delta 0), reused 0 (delta 0)\nTo https:\/\/github.com\/wuxiaomin98\/GitLearning.git\n * [new branch]      newBranch -&gt; newBranch\n<\/pre>\n<p>Now, you can check the remote repository again, you&#8217;ll see something different:<\/p>\n<pre class=\"brush:bash\">WXMs-MacBook-Pro:GitLearning WXM$ git remote show origin\n* remote origin\n  Fetch URL: https:\/\/github.com\/wuxiaomin98\/GitLearning.git\n  Push  URL: https:\/\/github.com\/wuxiaomin98\/GitLearning.git\n  HEAD branch: master\n  Remote branches:\n    master    tracked\n    newBranch tracked\n  Local branch configured for 'git pull':\n    master merges with remote master\n  Local refs configured for 'git push':\n    master    pushes to master    (up to date)\n    newBranch pushes to newBranch (up to date)\n<\/pre>\n<p>Right now, we have two branches: master and newBranch. Then, you can work on any of them.<\/p>\n<h2>3. Conclusion<\/h2>\n<p>In conclusion, this article shows you how to work with remote repository. Basically you need to clone to your local machine. Then work on separate branch. After this, push it to your remote repository. Done!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction As we all know, Git has been widely used by software developers. It&#8217;s free and open-source. Compared with other Version Control Systems, such as SVN (Apache Subversion) and CVS (Concurrent Version System), Git has its own advantages. Firstly, Git is powerful by its distributed nature, fast operation and branch handling mechanism. The distributed &hellip;<\/p>\n","protected":false},"author":73,"featured_media":27377,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1353],"tags":[1464],"class_list":["post-38891","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git","tag-git-push"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git Push Branch to Remote Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction As we all know, Git has been widely used by software developers. It&#039;s free and open-source. Compared with other Version Control Systems,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Push Branch to Remote Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction As we all know, Git has been widely used by software developers. It&#039;s free and open-source. Compared with other Version Control Systems,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-04T08:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-23T11:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jun Wu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jun Wu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\"},\"author\":{\"name\":\"Jun Wu\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6593091dba631ca0f41c4ba4e7c97678\"},\"headline\":\"Git Push Branch to Remote Example\",\"datePublished\":\"2016-07-04T08:00:07+00:00\",\"dateModified\":\"2019-04-23T11:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\"},\"wordCount\":1264,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"keywords\":[\"git push\"],\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\",\"name\":\"Git Push Branch to Remote Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"datePublished\":\"2016-07-04T08:00:07+00:00\",\"dateModified\":\"2019-04-23T11:30:00+00:00\",\"description\":\"1. Introduction As we all know, Git has been widely used by software developers. It's free and open-source. Compared with other Version Control Systems,\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Git Push Branch to Remote Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6593091dba631ca0f41c4ba4e7c97678\",\"name\":\"Jun Wu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Jun-Wu-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Jun-Wu-96x96.jpg\",\"caption\":\"Jun Wu\"},\"description\":\"Jun (Steven) Wu is a current Master student in Computer Science &amp; Engineering department of University of Nebraska Lincoln (Lincoln, NE, USA). His current interests focus on Programming Languages (Java, Python), Relational Database (MySQL), NoSQL Database (Apache Cassandra, MongoDB), and Computer Networks.\",\"sameAs\":[\"https:\/\/wuxiaomin98.wordpress.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/jun-wu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Push Branch to Remote Example - Java Code Geeks","description":"1. Introduction As we all know, Git has been widely used by software developers. It's free and open-source. Compared with other Version Control Systems,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/","og_locale":"en_US","og_type":"article","og_title":"Git Push Branch to Remote Example - Java Code Geeks","og_description":"1. Introduction As we all know, Git has been widely used by software developers. It's free and open-source. Compared with other Version Control Systems,","og_url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-07-04T08:00:07+00:00","article_modified_time":"2019-04-23T11:30:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","type":"image\/jpeg"}],"author":"Jun Wu","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Jun Wu","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/"},"author":{"name":"Jun Wu","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6593091dba631ca0f41c4ba4e7c97678"},"headline":"Git Push Branch to Remote Example","datePublished":"2016-07-04T08:00:07+00:00","dateModified":"2019-04-23T11:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/"},"wordCount":1264,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","keywords":["git push"],"articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/","url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/","name":"Git Push Branch to Remote Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","datePublished":"2016-07-04T08:00:07+00:00","dateModified":"2019-04-23T11:30:00+00:00","description":"1. Introduction As we all know, Git has been widely used by software developers. It's free and open-source. Compared with other Version Control Systems,","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-push-branch-remote-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Software Development","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/"},{"@type":"ListItem","position":3,"name":"Git","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/"},{"@type":"ListItem","position":4,"name":"Git Push Branch to Remote Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6593091dba631ca0f41c4ba4e7c97678","name":"Jun Wu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Jun-Wu-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Jun-Wu-96x96.jpg","caption":"Jun Wu"},"description":"Jun (Steven) Wu is a current Master student in Computer Science &amp; Engineering department of University of Nebraska Lincoln (Lincoln, NE, USA). His current interests focus on Programming Languages (Java, Python), Relational Database (MySQL), NoSQL Database (Apache Cassandra, MongoDB), and Computer Networks.","sameAs":["https:\/\/wuxiaomin98.wordpress.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/jun-wu\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/38891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=38891"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/38891\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/27377"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=38891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=38891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=38891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}