Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

EBC Exercise 16 git - Fork and Pull

From eLinux.org
Jump to: navigation, search

thumb‎ 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 and help.github.com/articles/fork-a-repo.

Forking a Repo

host$ git clone https://github.com/username/gitLearnFork.git
  • Configure remotes
host$ cd gitLearnFork
host$ git remote add upstream https://github.com/MarkAYoder/gitLearnFork.git
  • Pull in changes not present in your local repository, without modifying your files
host$ git fetch upstream 

More things you can do

  • Push commits to your remote repository stored on GitHub
host$ git push origin master
  • Fetch any new changes from the original repository
host$ git fetch upstream
  • Merge any changes fetched into your working files
host$ git merge upstream/master

The Pull Request

  • Add your name to helloWorld.c in your gitLearnFork repo
host$ gedit helloWorld.c
  • Commit it to your local repo
host$ git add helloWorld.c
host$ git commit -m "Put something meaningful here"
host$ git push
  • Go to your repo on github and initiate a Pull Request.
  • Wait for a response and then
host$ git fetch upstream
host$ git merge upstream/master

Congratulations, you've done a Fork and Pull.



thumb‎ Embedded Linux Class by Mark A. Yoder