Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_github_workflow [2020/01/27 14:28] – [Fork the project of interest] rpjday | git_github_workflow [2020/01/27 17:03] (current) – [Clone your personal fork to your local machine] rpjday | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| So go ahead and create that personal GitHub fork before going any further. | So go ahead and create that personal GitHub fork before going any further. | ||
| - | ==== Clone your fork to your local machine ==== | + | ==== Clone your personal |
| - | Once you've made that personal GitHub fork (in my case, '' | + | Once you've made that personal GitHub fork (agin, in my case, '' |
| - | Since you'll be working with two remotes for this workflow, when you clone your personal fork, use a name other than the default of '' | + | Since you' |
| < | < | ||
| $ mkdir podman/ | $ mkdir podman/ | ||
| $ cd podman/ | $ cd podman/ | ||
| - | $ git clone https:// | + | $ git clone -o rpjday |
| </ | </ | ||
| - | Everything | + | Verify that everything |
| < | < | ||
| + | $ cd git | ||
| $ git status | $ git status | ||
| On branch master | On branch master | ||
| Line 42: | Line 43: | ||
| </ | </ | ||
| - | In addition, you can verify that your local clone has one registered remote -- your personal GitHub fork: | + | In addition, you can verify that your local clone has one registered remote -- your personal GitHub fork with remote name '' |
| < | < | ||
| Line 53: | Line 54: | ||
| Again, keep in mind that this remote is where you will push your intended contributions to the public project. | Again, keep in mind that this remote is where you will push your intended contributions to the public project. | ||
| - | ==== Adding a remote for the main project ==== | + | ==== Adding a remote for the public |
| - | You now have to add a remote for the main project | + | In addition |
| + | |||
| + | Again, for clarity, choose a remote name other than the default of '' | ||
| < | < | ||
| - | $ git remote add progit | + | $ git remote add libpod |
| $ | $ | ||
| </ | </ | ||
| - | Verify the new remote: | + | You can now verify that your local clone has two registered remotes -- one for pulling |
| < | < | ||
| $ git remote -v | $ git remote -v | ||
| - | origin https:// | + | libpod https:// |
| - | origin https:// | + | libpod https:// |
| - | progit https:// | + | rpjday https:// |
| - | progit | + | rpjday https:// |
| $ | $ | ||
| </ | </ | ||
| Line 76: | Line 79: | ||
| < | < | ||
| - | $ cat .git/ | + | $ cat .git/config |
| [core] | [core] | ||
| repositoryformatversion = 0 | repositoryformatversion = 0 | ||
| Line 82: | Line 85: | ||
| bare = false | bare = false | ||
| logallrefupdates = true | logallrefupdates = true | ||
| - | [remote "origin"] | + | [remote "rpjday"] |
| - | url = https:// | + | url = https:// |
| - | fetch = +refs/ | + | fetch = +refs/ |
| [branch " | [branch " | ||
| - | remote = origin | + | remote = rpjday |
| merge = refs/ | merge = refs/ | ||
| - | [remote "progit"] | + | [remote "libpod"] |
| - | url = https:// | + | url = https:// |
| - | fetch = +refs/ | + | fetch = +refs/ |
| $ | $ | ||
| </ | </ | ||
| - | ==== Keeping up to date ==== | + | ==== Keeping up to date with public content |
| - | Before | + | Even as you're working on contributions |
| - | First, fetch from the upstream '' | + | First, you can, as often as you like, fetch from the upstream |
| < | < | ||
| - | $ git fetch progit | + | $ git fetch libpod |
| </ | </ | ||
| - | Next, manually | + | Occasionally, you might want to merge that new content into your local '' |
| < | < | ||
| - | $ git merge progit/master | + | $ git checkout master |
| + | $ git merge libpod/master | ||
| </ | </ | ||
| - | Finally, push this new content | + | Finally, |
| < | < | ||
| - | $ git push origin | + | $ git push rpjday |
| </ | </ | ||
| Do all of this on a regular basis to keep everything in sync. | Do all of this on a regular basis to keep everything in sync. | ||
| - | ==== Contributing changes ==== | + | ===== Contributing changes |
| - | Contributing changes to the main project involves three steps: | + | ==== The general steps in contributing changes ==== |
| + | |||
| + | Contributing changes to the public GitHub | ||
| * Make and commit some //local changes// (preferably on a feature branch). | * Make and commit some //local changes// (preferably on a feature branch). | ||
| - | * Push those changes (that branch) to your GitHub fork. | + | * Push those changes (that branch) to your personal |
| - | * Make a "pull request" | + | * Over at GitHub, make a "pull request" |
| + | |||
| + | ==== Making some local changes ==== | ||
| - | First, create | + | For each set of related changes, start a new feature |
| < | < | ||
| - | $ git checkout -b topic/rpjday/issue42 | + | $ git checkout -b rpjday/README_changes |
| - | Switched to a new branch 'topic/rpjday/issue42' | + | Switched to a new branch ' |
| $ | $ | ||
| </ | </ | ||
| - | Make a simple change | + | For our example, make some trivial changes |
| < | < | ||
| - | $ git checkout | + | $ git commit |
| - | Switched to a new branch ' | + | [rpjday/README_changes b1a09348] README.md: silly changes |
| + | 1 file changed, 4 insertions(+) | ||
| $ | $ | ||
| </ | </ | ||
| + | ==== Pushing your work ==== | ||
| + | |||
| + | You can continue adding and committing (related) work to this feature branch and, once you're satisfied, you can push that branch to your personal GitHub fork with: | ||
| < | < | ||
| - | $ git commit -a -m "fix issue42" | + | $ git push rpjday rpjday/README_changes |
| - | [topic/rpjday/issue42 77fad5f] topic/rpjday/issue42 | + | |
| - | 1 file changed, 1 insertion(+), | + | |
| - | $ | + | |
| </ | </ | ||
| - | < | + | ==== And over At GitHub ==== |
| - | $ git show | + | |
| - | commit 77fad5f0aadd229628baa7811b0b49c7580d96f0 (HEAD -> topic/ | + | |
| - | Author: Robert P. J. Day < | + | |
| - | Date: Wed Feb 14 07:06:42 2018 -0500 | + | |
| - | fix issue42 | + | Provided you're logged into your account at GitHub, you'll suddenly see the appearance of a new branch '' |
| - | diff --git a/ | + | If all goes well and your change is accepted and committed (in this case, into the '' |
| - | index d7810fd..126bfd4 100644 | + | |
| - | --- a/ | + | < |
| - | +++ b/ | + | $ git fetch libpod |
| - | @@ -1,4 +1,4 @@ | + | $ git merge libpod/ |
| - | -= Pro Git, Second Edition | + | |
| - | += Pro Git, Second Edition (rday change) | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | $ | + | |
| </ | </ | ||
| - | At this point, you can push this new branch to your GitHub fork: | + | In addition, if you have no further need of that local feature, you can delete it: |
| < | < | ||
| - | $ git push origin topic/rpjday/issue42 | + | $ git branch -d rpjday/README_changes |
| </ | </ | ||
| - | ==== And over At GitHub | + | ==== Adjusting your local branch |
| - | Provided you're logged into your account at GitHub, you'll suddenly see the appearance of a new branch | + | Given the possibility that your pull request might provoke some comments about possible improvements, you can make those local improvements, |
| - | + | ||
| - | 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 '' | + | |
| < | < | ||
| - | $ git fetch progit | + | $ git push -f rpjday rpjday/README_changes |
| - | $ git merge progit/master | + | |
| </ | </ | ||
| - | |||
| - | In addition, you can now delete the '' | ||