Git guidelines

March 30, 2016 · View on GitHub

Back to: README > developers guide >

Git guidelines

Here you will have some common GIT actions you want to execute while working with Nanos++.


GIT Patch Developers


GIT PM-Staff Developers


GIT Workflow Commands


GIT Workflow Commands


0) Identifying yourself in GIT (only once)

$ git config --global user.name "John Smith"
$ git config --global user.email john.smith@university.edu

1) Getting the (public) repository

$ git clone ​http://pm.bsc.es/git/nanox.git

2) Work on your master local branch

2.1) Update files 1

$ git commit -a -m "Fix-message-1"

2.2) Update files 2

$ git commit -a -m "Fix-message-2"
·
·
·
2.n) Update files n

$ git commit -a -m "Fix-message-n"

3) Update your local copy

$ git pull

Resolve conflicts, if any (and then commit):

$ git commit -a -m "Conflict Resolution"

4) Create patches ( and send by mail)

$ git format-patch origin

It will create a list of patches:

0001-Fix-message-1
0002-Fix-message-2
nnnn-Fix-message-N


Identifying yourself in GIT (only once)

$ git config --global user.name "Juan Nadie"
$ git config --global user.email juan.nadie@bsc.es

Checking your settings

$ git config --list

Getting the (private) repository

$ git clone ​https://pm.bsc.es/git-dev/nanox.git

Checking current branch's status

$ git status

Checking current branch's log

$ git log

How to commit all current changes

$ git commit -a -m "Commit description"

How to commit part of current changes

$ git commit list-of-files -m "Commit description"

How to get updates from origin

$ git pull

This is a shorthand for:

$ git fetch
$ git merge

How to publish your updates

$ git push


List local/remote branches

$ git branch
list of local branches

$ git branch -r
list of remote branches

How to switch to a local branch

$ git checkout branch-1

How to create a local branch

$ git checkout -b branch_name

This is a shorthand for:

$ git branch branch_name
$ git checkout branch_name

How to merge a branch into current one

$ git merge --no-ff branch_name

How to create a remote branch

a) from scratch...

$ git push origin origin:refs/heads/branch_name

b) from a local branch...

$ git push origin branch_name

How to get a remote branch

$ git checkout -b branch_name origin/branch_name

How to delete a branch

a) which is a local branch...

$ git branch -d branch_name

b) which is a remote branch...

$ git push origin :branch_name

List (no) merged branches into current

$ git branch {--merged | --no-merged}

How to see differences between branches

$ git merge-base branch-1 branch-2
36c7dba2c95e6bbb78dfa822519ecfec6e1ca649

$ git diff 36c7db

-- or --

$ git diff branch-1...branch-2