8/19/2014 11:05:51 PM
Installing Git on Ubuntu apt-get install libcurl4-gnutls-dev libexpat1-dev gettext apt-get install git Command Lines List config settings git config --list Get config git config user.name Set Name git config --global user.name "YOUR NAME" Set Email git config --global user.email "YOUR EMAIL ADDRESS" Initialize Current Directory git init Add files/stage files git add git add *.txt git add "this file.html" Add all untracked and changed files, excluding ignored files git add * To add deleted files and stage all tracked modified files git add -u Add ignored file git add -f filename.txt Remove currently tracked file git rm --cached file Status git status Diff git diff Commit git commit git commit -m "I Made a Commit" *if you are using VI to edit doc i to finish editing esc to save :wq -get current branch hash git rev-parse --short HEAD -revert to previous hash git checkout MYHASHFROMABOVECOMMAND Clone git clone https://github.com/[me]/Testing.git git clone https://github.com/[me]/Testing.git "My Alternate Name" Push git push Update Remote (GitHub) git push origin - Push new branch to origin git push -u origin master git push -u origin devBranch Push Unclones Repo to Remote Server git remote add origin <server> Branching List Branches git branch Create a Branch git branch dev Checkout a branch git checkout dev git checkout master git branch -a get new branchs git fetch Delete a Local Branch git branch -d the_local_branch Tagging * tags cannot have spaces List Tags git tag List Tags by filter git tag -l 1.* Created Annotated Tags git tag -a v1.0 -m 'the beginning' Share Tags (tags are not automatically pushed) git push origin v1.0 Push all unshared tags git push origin --tags Rebase rebase a branch to master, checkout branch you want to rebase to git checkout dev git rebase master Reset / Revert / Rollback rollback current branch to last commit git reset --hard Change Origin Url git remote set-url origin https://username@bitbucket.org/username/myrepo.git Methods Merge with Remote Repo git remote add 3rdparty-repo <remote_repo_url.git> git fetch 3rdparty-repo checkout/create new branch to merge their changes to git checkout my_branch Merge their changes in (assuming they did their work on the master branch) git merge 3rdparty-repo/master Windows Git Bash Change to C drive cd c: Open Current Directory in Explorer explorer .Set Name Store Username/Password git config --global credential.helper wincred