User Tools

Site Tools


git_github_workflow

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
git_github_workflow [2018/02/14 12:12]
rpjday [Contributing changes]
git_github_workflow [2020/01/27 13:30]
rpjday [Overview]
Line 1: Line 1:
 ===== Overview ===== ===== Overview =====
  
-Typical workflow for contributing to a public GitHub project, demonstrating the use of branches and remotes.+Typical workflow for contributing to a public GitHub project, demonstrating the use of branches and remotes. For this demonstration,​ I'll use a Git Hub project I've been contributing to recently -- [[https://​github.com/​containers/​libpod]] -- which is the source of the Docker lookalike ''​podman''​ command.
  
 ===== Steps in the workflow ===== ===== Steps in the workflow =====
Line 50: Line 50:
  
 <​code>​ <​code>​
-$ git remote add progit2 ​https://​github.com/​progit/​progit2+$ git remote add progit ​https://​github.com/​progit/​progit2
 $ $
 </​code>​ </​code>​
Line 60: Line 60:
 origin https://​github.com/​rpjday/​progit2 (fetch) origin https://​github.com/​rpjday/​progit2 (fetch)
 origin https://​github.com/​rpjday/​progit2 (push) origin https://​github.com/​rpjday/​progit2 (push)
-progit2 https://​github.com/​progit/​progit2 (fetch) +progit https://​github.com/​progit/​progit2 (fetch) 
-progit2 https://​github.com/​progit/​progit2 (push)+progit  ​https://​github.com/​progit/​progit2 (push)
 $ $
 </​code>​ </​code>​
Line 80: Line 80:
  remote = origin  remote = origin
  merge = refs/​heads/​master  merge = refs/​heads/​master
-[remote "progit2"]+[remote "progit"]
  url = https://​github.com/​progit/​progit2  url = https://​github.com/​progit/​progit2
  fetch = +refs/​heads/​*:​refs/​remotes/​progit2/​*  fetch = +refs/​heads/​*:​refs/​remotes/​progit2/​*
Line 90: Line 90:
 Before you even start contributing to the main project, there are three steps involved in keeping up with everyone else's contributions. Before you even start contributing to the main project, there are three steps involved in keeping up with everyone else's contributions.
  
-First, fetch from the upstream ''​progit2''​ remote into the remote tracking branch ''​progit2/​master'':​+First, fetch from the upstream ''​progit''​ remote into the remote tracking branch ''​progit/​master'':​
  
 <​code>​ <​code>​
-$ git fetch progit2+$ git fetch progit
 </​code>​ </​code>​
  
Line 99: Line 99:
  
 <​code>​ <​code>​
-$ git merge progit2/master+$ git merge progit/master
 </​code>​ </​code>​
  
Line 121: Line 121:
  
 <​code>​ <​code>​
-$ git checkout -b sillyb +$ git checkout -b topic/​rpjday/​issue42 
-Switched to a new branch 'sillyb'+Switched to a new branch 'topic/​rpjday/​issue42'
 $ $
 </​code>​ </​code>​
Line 129: Line 129:
  
 <​code>​ <​code>​
-$ git checkout -b sillyb +$ git checkout -b topic/​rpjday/​issue42 
-Switched to a new branch 'sillyb'+Switched to a new branch 'topic/​rpjday/​issue42'
 $ $
 </​code>​ </​code>​
  
 <​code>​ <​code>​
-$ git commit -a -m "silly change+$ git commit -a -m "fix issue42
-[sillyb ​77fad5f] ​silly change+[topic/​rpjday/​issue42 ​77fad5f] ​topic/​rpjday/​issue42
  1 file changed, 1 insertion(+),​ 1 deletion(-)  1 file changed, 1 insertion(+),​ 1 deletion(-)
 $ $
Line 143: Line 143:
 <​code>​ <​code>​
 $ git show $ git show
-commit 77fad5f0aadd229628baa7811b0b49c7580d96f0 (HEAD -> sillyb)+commit 77fad5f0aadd229628baa7811b0b49c7580d96f0 (HEAD -> topic/​rpjday/​issue42)
 Author: Robert P. J. Day <​rpjday@crashcourse.ca>​ Author: Robert P. J. Day <​rpjday@crashcourse.ca>​
 Date:   Wed Feb 14 07:06:42 2018 -0500 Date:   Wed Feb 14 07:06:42 2018 -0500
  
-    ​silly change+    ​fix issue42
  
 diff --git a/​README.asc b/​README.asc diff --git a/​README.asc b/​README.asc
Line 165: Line 165:
  
 <​code>​ <​code>​
-$ git push origin ​sillyb+$ git push origin ​topic/​rpjday/​issue42
 </​code>​ </​code>​
  
Line 175: Line 175:
  
 <​code>​ <​code>​
-$ git fetch progit2 +$ git fetch progit 
-$ git merge progit2/master+$ git merge progit/master
 </​code>​ </​code>​
  
 In addition, you can now delete the ''​sillyb''​ branch if you have no further use for it. In addition, you can now delete the ''​sillyb''​ branch if you have no further use for it.
git_github_workflow.txt · Last modified: 2020/01/27 17:03 by rpjday