GIT Cheatsheet - noduslabs/infranodus GitHub Wiki

Pretend like the files do not change (for stats files):

 git update-index --assume-unchanged statsabove.ejs
 git update-index --assume-unchanged statsbelow.ejs

To set up repository:

git init

git add *

git commit -a -m 'added repo'

For GitHub also create README.md file.

Change remote repository URL:

git remote set-url origin https://github.com/CyberCRI/KnowNodes.git

or

git remote add origin https://github.com/noduslabs/infranodus.git

To submit a pull request:

git checkout -b newbranch (creating a new branch)

then

git push origin newbranch

then in github's interface submit a pull request for the branch. To see the differences between the current version and the previous commit:

git diff file_path_name

To see the differences between the current head and two commits ago:

git diff HEAD^^ HEAD file_path_name

To return to previous commit without saving changes:

git reset --hard HEAD

To check the status of the current files in relation to the previous commit:

git status

To commit only one file:

git commmit file_name -m 'description of commit'

To quit VIM Terminal editor (if entering desc manually): Esc :wq (w for write, q for quit).

To commit all changes:

git commit -a -m 'added a new footer [issue 53]'

Remove some files from being tracked for the next commit:

git checkout -- file_name

Remove a branch:

git branch -d hotfix

Remove a branch on remote

git push origin --delete branch_name