Difference between revisions of "EBC git - Fork and Pull"
(Removed host$ prompt) |
m (→Forking a Repo) |
||
Line 8: | Line 8: | ||
== Forking a Repo == | == Forking a Repo == | ||
* Go to [https://github.com/MarkAYoder/gitLearnFork github.com/MarkAYoder/gitLearnFork] | * Go to [https://github.com/MarkAYoder/gitLearnFork github.com/MarkAYoder/gitLearnFork] | ||
− | * Click the Fork button in the | + | * Click the Fork button in the upper right |
* Clone your fork | * Clone your fork | ||
$ '''git clone https://github.com/''username''/gitLearnFork.git''' | $ '''git clone https://github.com/''username''/gitLearnFork.git''' | ||
Line 15: | Line 15: | ||
$ '''git remote add upstream https://github.com/MarkAYoder/gitLearnFork.git''' | $ '''git remote add upstream https://github.com/MarkAYoder/gitLearnFork.git''' | ||
* Pull in changes not present in your local repository, without modifying your files | * Pull in changes not present in your local repository, without modifying your files | ||
− | $ '''git fetch upstream''' | + | $ '''git fetch upstream''' |
== More things you can do == | == More things you can do == |
Revision as of 01:42, 11 August 2015
Embedded Linux Class by Mark A. Yoder
In a previous exercise you learned how to use git locally and with a shared repository. Here you will work though an example of using git collaboratively using the Fork and Pull workflow. This method works better when working with large groups.
Much of the material here has come from help.github.com/articles/fork-a-repo.
Forking a Repo
- Go to github.com/MarkAYoder/gitLearnFork
- Click the Fork button in the upper right
- Clone your fork
$ git clone https://github.com/username/gitLearnFork.git
- Configure remotes
$ cd gitLearnFork $ git remote add upstream https://github.com/MarkAYoder/gitLearnFork.git
- Pull in changes not present in your local repository, without modifying your files
$ git fetch upstream
More things you can do
- Push commits to your remote repository stored on GitHub
$ git push origin master
- Fetch any new changes from the original repository
$ git fetch upstream
- Merge any changes fetched into your working files
$ git merge upstream/master
The Pull Request
- Add your name to helloWorld.c in your gitLearnFork repo
$ gedit helloWorld.c
- Commit it to your local repo
$ git add helloWorld.c $ git commit -m "Put something meaningful here" $ git push
- Go to your repo on github and initiate a Pull Request.
- Wait for a response and then
$ git fetch upstream $ git merge upstream/master
Congratulations, you've done a Fork and Pull.
Embedded Linux Class by Mark A. Yoder