Skip to content

Commit 9a48cda

Browse files
committed
Suggest some changes
1 parent 4bcbaea commit 9a48cda

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

book/06-github/sections/2-contributing.asc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Here's how it generally works:
4343
5. Open a Pull Request on GitHub.
4444
6. Discuss, and optionally continue committing.
4545
7. The project owner merges or closes the Pull Request.
46-
8. Put the changes back in your GitHub public repository.
46+
8. Sync the updated master back to your fork.
4747

4848
This is basically the Integration Manager workflow covered in <<ch05-distributed-git#_integration_manager>>, but instead of using email to communicate and review changes, teams use GitHub's web based tools.
4949

@@ -422,13 +422,9 @@ If you look at <<_md_drag>>, you can see a small ``Parsed as Markdown'' hint abo
422422
[[_fetch_and_push_on_different_repositories]]
423423
==== Keep your GitHub public repository up-to-date
424424

425-
Once you forked from a GitHub repository, your forked repository lives alone and is autonomous regarding the original one.
425+
Once you've forked a GitHub repository, your repository (your "fork") exists independently from the original.
426426
In particular, when the original repository has new commits, GitHub informs you by a message like:
427-
[source,text]
428-
----
429-
This branch is X commits behind <organization>:master.
430-
----
431-
For example:
427+
432428
[source,text]
433429
----
434430
This branch is 5 commits behind progit:master.
@@ -446,34 +442,39 @@ $ git checkout master <1>
446442
$ git pull https://github.com/progit/progit2.git <2>
447443
$ git push origin master <3>
448444
----
445+
449446
<1> If you were on another branch, return to `master`.
450447
<2> Fetch changes from `https://github.com/progit/progit2.git` and merge them into `master`.
451448
<3> Push your `master` branch to `origin`.
452449

453-
This just works but it is a little verbose.
454-
Another possibility allows to do the same thing without the need to precise the repositories to pull from and push to.
455-
To do so, you need a few configuration:
450+
This works, but it is a little tedious having to spell out the fetch URL every time.
451+
You can automate this work with a bit of configuration:
456452

457453
[source,console]
458454
----
459455
$ git remote add progit https://github.com/progit/progit2.git <1>
460456
$ git branch --set-upstream-to=progit/master master <2>
461457
$ git config --local remote.pushDefault origin <3>
462458
----
459+
463460
<1> Add the source repository and give it a name.
464461
Here, I have chosen to call it `progit`.
465-
<2> Set your `master` branch follow `progit`.
466-
Then your future fetches will fetch from `progit`.
462+
<2> Set your `master` branch to fetch from the `progit` remote.
467463
<3> Define the default push repository to `origin`.
468464

469-
Now you can fetch from `progit` and push to `origin` as simply as:
465+
Once this is done, the workflow becomes much simpler:
470466

471467
[source,console]
472468
----
473469
$ git checkout master <1>
474470
$ git pull <2>
475471
$ git push <3>
476472
----
473+
477474
<1> If you were on another branch, return to `master`.
478475
<2> Fetch changes from `progit` and merge changes into `master`.
479476
<3> Push your `master` branch to `origin`.
477+
478+
This approach can be useful, but it's not without downsides.
479+
Git will happily do this work for you silently, but it won't warn you if you make a commit to `master`, pull from `progit`, then push to `origin` -- all of those operations are valid with this setup.
480+
So you'll have to take care never to commit directly to `master`, since that branch effectively belongs to the upstream repository.

0 commit comments

Comments
 (0)