You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/06-github/sections/2-contributing.asc
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ Here's how it generally works:
43
43
5. Open a Pull Request on GitHub.
44
44
6. Discuss, and optionally continue committing.
45
45
7. The project owner merges or closes the Pull Request.
46
+
8. Sync the updated master back to your fork.
46
47
47
48
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.
48
49
@@ -417,3 +418,63 @@ This isn't technically GitHub Flavored Markdown, but it is incredibly useful. In
417
418
image::images/markdown-08-drag-drop.png[Drag and drop images]
418
419
419
420
If you look at <<_md_drag>>, you can see a small ``Parsed as Markdown'' hint above the text area. Clicking on that will give you a full cheat sheet of everything you can do with Markdown on GitHub.
421
+
422
+
[[_fetch_and_push_on_different_repositories]]
423
+
==== Keep your GitHub public repository up-to-date
424
+
425
+
Once you've forked a GitHub repository, your repository (your "fork") exists independently from the original.
426
+
In particular, when the original repository has new commits, GitHub informs you by a message like:
427
+
428
+
[source,text]
429
+
----
430
+
This branch is 5 commits behind progit:master.
431
+
----
432
+
433
+
But your GitHub repository will never be automatically updated by GitHub; this is something that you must do yourself.
434
+
Fortunately, this is very easy to do.
435
+
436
+
One possibility to do this requires no configuration.
437
+
For example, if you forked from `https://github.com/progit/progit2.git`, you can keep your `master` branch up-to-date like this:
<2> Set your `master` branch to fetch from the `progit` remote.
463
+
<3> Define the default push repository to `origin`.
464
+
465
+
Once this is done, the workflow becomes much simpler:
466
+
467
+
[source,console]
468
+
----
469
+
$ git checkout master <1>
470
+
$ git pull <2>
471
+
$ git push <3>
472
+
----
473
+
474
+
<1> If you were on another branch, return to `master`.
475
+
<2> Fetch changes from `progit` and merge changes into `master`.
476
+
<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