Git CheatSheet

A little compilation of the git command sequences i use most, to avoid forgetting’em:

Commit / Push to repo:

cd /c/projects/ProjectName
git status – Have a look at the files that have been modified, included, or deleted after the last commit
git add . – If i consider that all files should be included (this is the most usual case for me)
git commit -am “refs #tasknumber description of the implemented features” – commit changes
git push origin mybranchname – push commited changes to remote repository

Getting another developer’s branch (lets call him X):

git checkout devX
git pull origin devX

Merging my branch with another developer’s branch (again, X’s branch)

git checkout devX
git pull origin devX
git checkout mybranch
git merge devX

Directly pulling someone else’s brach to mine.

git checkout devX
git pull origin devX
git checkout mybranch
git pull origin devX

Getting the repo

cd /c/projects/Android/
git clone https://github.com/voghDev/android-examples.git
cd /c/projects/Android/android-examples
cat “This is a test” > README.md
git commit -am “Updated readme file”
git push

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s