To help understand how git works, I scrambled this post on what I know about simple workflow in git. I first started my project locally and then I added VCS using ‘git init’ in the existing project’s root directory.
Then I wanted to host it on github. I did this by creating
git push -u https://github.com/choikwa/gitTest.git
But if I want to skip adding “-u https://github.com/choikwa/gitTest.git” everytime I push, I can do:
git remote add up https://github.com/choikwa/gitTest.git
If I want to compare my local current branch commits to my remote’s branch, I need to do:
git branch –set-upstream master up/master //replace master with your branch
To see your tracked files:
To see your modifications, here is neat coloured output:
git log –pretty=format:”%Cblue%h:%Cred%ce: %Cgreen%s” –name-status –graph
Make alias of above in your .gitconfig in default home directory.
hist = log –pretty=format:\”%Cblue%h:%Cred%ce: %Cgreen%s\” –name-status –graph
A common thing is to compare my local branch to remote for unpushed commits. You can do this by:
git hist origin.. //this is implied as git hist origin..master
The converse, “git hist ..origin” would show how far your remote is ahead in commits.