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
git_github_workflow [2020/01/27 15:03] – [Making some local changes] rpjdaygit_github_workflow [2020/01/27 17:03] (current) – [Clone your personal fork to your local machine] rpjday
Line 21: Line 21:
 ==== Clone your personal fork to your local machine ==== ==== Clone your personal fork to your local machine ====
  
-Once you've made that personal GitHub fork (agin, in my case, ''rpjday/libpod''), you need to make one more copy of the repository -- this one will be clone of your personal fork to your //local// machine, which represents the working tree in which you create new branches and make local changes that you'll push to your GitHub fork for eventual incorporation into the public project, but here's the trick for clarity.+Once you've made that personal GitHub fork (agin, in my case, ''rpjday/libpod''), you need to make one more copy of the repository -- this one will be clone of your personal fork to your //local// machine, which represents the working tree in which you create new branches and make local changes that you'll push to your GitHub fork for eventual incorporation into the public project, but here's the trick for clarity.
  
 Since you'll (shortly) be working with two remotes for this workflow, when you clone your personal fork, select a remote name other than the default of ''origin'' -- I'll use the remote name of ''rpjday'' to clearly identify that this is the remote corresponding to my personal fork over at GitHub, not the public project: Since you'll (shortly) be working with two remotes for this workflow, when you clone your personal fork, select a remote name other than the default of ''origin'' -- I'll use the remote name of ''rpjday'' to clearly identify that this is the remote corresponding to my personal fork over at GitHub, not the public project:
Line 28: Line 28:
 $ mkdir podman/libpod $ mkdir podman/libpod
 $ cd podman/libpod $ cd podman/libpod
-$ git clone https://github.com/rpjday/libpod git+$ git clone -o rpjday https://github.com/rpjday/libpod git
 </code> </code>
  
Line 145: Line 145:
  
 <code> <code>
-$ git commit -a -m "silly changes to README.md" +$ git commit -a -m "README.md: silly changes
-[topic/rpjday/issue42 77fad5ftopic/rpjday/issue42 +[rpjday/README_changes b1a09348README.md: silly changes 
- 1 file changed, 1 insertion(+), 1 deletion(-)+ 1 file changed, 4 insertions(+)
 $ $
 </code> </code>
 +==== Pushing your work ====
  
-<code> +You can continue adding and committing (relatedwork to this feature branch and, once you're satisfied, you can push that branch to your personal GitHub fork with:
-$ git show +
-commit 77fad5f0aadd229628baa7811b0b49c7580d96f0 (HEAD -> topic/rpjday/issue42) +
-AuthorRobert P. J. Day <rpjday@crashcourse.ca> +
-Date:   Wed Feb 14 07:06:42 2018 -0500+
  
-    fix issue42 +<code> 
- +git push rpjday rpjday/README_changes
-diff --git a/README.asc b/README.asc +
-index d7810fd..126bfd4 100644 +
---- a/README.asc +
-+++ b/README.asc +
-@@ -1,4 +1,4 @@ +
--= Pro Git, Second Edition +
-+= Pro Git, Second Edition (rday change) +
-  +
- Welcome to the second edition of the Pro Git book. +
-  +
-$+
 </code> </code>
  
-==== Pushing your work ====+==== And over At GitHub ====
  
-At this point, you can push this new branch to your GitHub fork:+Provided you're logged into your account at GitHub, you'll suddenly see the appearance of a new branch ''rpjday/README_changes''. If you think it's ready to go, you can select "Compare & pull request" to examine and confirm that you want to hand that off to the main project. 
 + 
 +If all goes well and your change is accepted and committed (in this case, into the ''master'' branch), you will have to perform the two earlier steps to fetch and merge your changes into your local clone into the ''master'' branch:
  
 <code> <code>
-$ git push rpjday/README_changes+$ git fetch libpod 
 +$ git merge libpod/master
 </code> </code>
  
-==== And over At GitHub ====+In addition, if you have no further need of that local feature, you can delete it:
  
-Provided you're logged into your account at GitHub, you'll suddenly see the appearance of a new branch ''sillyb''. If you think it's ready to go, you can select "Compare & pull request" to examine and confirm that you want to hand that off to the main project.+<code> 
 +$ git branch -d rpjday/README_changes 
 +</code> 
 + 
 +==== Adjusting your local branch ====
  
-If all goes well and your change is accepted and committed, you will have to perform the two earlier steps to fetch and merge your changes into your local clone into the ''master'' branch:+Given the possibility that your pull request might provoke some comments about possible improvements, you can make those local improvements, stage them and commit them on the same branch as before, then force push that branch to replace the older one:
  
 <code> <code>
-$ git fetch progit +$ git push -f rpjday rpjday/README_changes
-$ git merge progit/master+
 </code> </code>
- 
-In addition, you can now delete the ''sillyb'' branch if you have no further use for it. 
  • git_github_workflow.1580137398.txt.gz
  • Last modified: 2020/01/27 15:03
  • by rpjday