Git Examples

Using GitHub and Git on Windows.

First fork on GitHub and then clone

On GitHub do a fork:

https://github.com/YangModels/yang

My clone is:

https://github.com/samans/yang.git

git clone https://github.com/samans/yang

Git Merge Update:

  1. git fetch upstream    (fetch all upstream, aka YangModels/yang, branches and put them in upstream/master etc.)
  2. git checkout master    (switch to your local master)
  3. git merge upstream/master    (merge the changes that you fetched in step 1)

Check that my PC workspace is up-to-date with origin/master

  1. git fetch    (this fetches origin and therefore updates origin/master)
  2. git checkout master    (this switches to master; it also warns you if origin/master is ahead of master)
  3. git pull    (this pulls changes from origin/master to master; this should be a fast-forward)

Do the new work in a branch

git checkout -b newThing

**do the modifications necessary**

 git add -A (or list the files)

git commit

git push -u origin newThing

Then go to github and do a pull request that will request YangModels/yang to be updated with newThing from origin (my remote).

Sidebar