Skip to content

Setting up Git

Jeremy Weed edited this page Aug 31, 2017 · 3 revisions
$ sudo apt-get update
$ sudo apt-get install git
$ git config --global user.name "Your Name"
$ git config --global user.email "youremail@domain.com"

From here you will want to log into Github, and then navigate to qubo, and click the fork button in the upper right of the screen. After the project has beenforked you should be looking at the code in your account. Now get the https link to clone the project locally, and enter the following in your terminal (the link below is specific to my branch).

$ git clone https://github.com/hephaestus9/qubo.git
$ cd qubo
$ git remote -v

  origin https://github.com/hephaestus9/qubo.git (fetch)
  origin https://github.com/hephaestus9/qubo.git (push)
$ git remote add upstream https://github.com/robotics-at-maryland/qubo.git

$ git remote -v
origin https://github.com/hephaestus9/qubo.git (fetch)
origin https://github.com/hephaestus9/qubo.git (push)
upstream https://github.com/robotics-at-maryland/qubo.git (fetch)
upstream https://github.com/robotics-at-maryland/qubo.git (push)

Now, if the upstream code changes, and you need to update your fork, enter the following.

$ git fetch upstream

You should see output similar to the following:

remote: Counting objects: 14, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
From https://github.com/robotics-at-maryland/qubo
-  [new branch] broken -> upstream/broken
-  [new branch] controls -> upstream/controls
-  [new branch] embedded -> upstream/embedded
-  [new branch] master -> upstream/master
-  [new branch] qubo\_ros -> upstream/qubo\_ros
-  [new branch] qubobus -> upstream/qubobus
-  [new branch] vision -> upstream/vision

Now,

$ git checkout master
$ git merge upstream/master

and your output should be something along these lines:

Updating 8957fe6..4b792e3
Fast-forward
README.md | 8 --------
launch/dvl\_launch.launch | 3 ++-
scripts/install\_dependencies.bash | 6 +++++-
src/controls/CMakeLists.txt | 9 ++++-----
src/joystick/CMakeLists.txt | 9 ++++-----
src/ram\_cpp\_utils/CMakeLists.txt | 3 +--
src/ram\_cpp\_utils/test/ConversionTests.cpp | 2 +-
src/vision/CMakeLists.txt | 15 +++++----------
src/vl\_qubo/CMakeLists.txt | 2 +-
src/vl\_qubo/drivers/dvl/src/DVL.cpp | 19 +++++++++----------
src/vl\_qubo/drivers/dvl/src/impl.cpp | 84
+++++++++++++++++++++++++-----------------------------------------------------------
src/vl\_qubo/dvl/include/dvl\_qubo.h | 5 +++++
src/vl\_qubo/dvl/src/dvl\_qubo.cpp | 74
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
src/vl\_tortuga/CMakeLists.txt | 20 +++++++++++---------
14 files changed, 133 insertions(+), 126 deletions(-)

If you would like to keep your code on github up to date with the local code:

$ git add .

$ git commit -m "Sync with upstream"

$ git push origin master
Username for 'https://github.com':
Password for 'https://hephaestus9@github.com':
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.77 KiB | 0 bytes/s, done.
Total 14 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), completed with 7 local objects.
To https://github.com/hephaestus9/qubo.git
8957fe6..4b792e3 master -> master

References:

Fork A Repo

Forking Projects

Configuring a remote for a fork

Syncing a fork

Adding an existing project to GitHub using the command line

Clone this wiki locally