Sunday, 17 March 2019

Git Cheat Sheet

git init   # initialise directory for git repos
git status # tells user what possible files need to be 'added' or what files have changed.
git add . # add all files
git add filename1 filename2 # add numerous files to git 'staging area'
git log # show log of commits with their hash codes


git diff filename # to find out difference between working directory and last commit in staging directory
git checkout filename # to revert back a particular commit (last commit ) COMPARE THIS TO BRANCH CREATION

git checkout -b branchname #

git remote add origin https://github.com/johnny/myproject.git
#git remote add <REMOTE> GIT_URL
git remote -v # check settings

git push -u origin master
git push -u <REMOTE> <BRANCH>


git clone https://github.com/johnny/myproject.git 

No comments:

Post a Comment