1/5/2019 - 12:27 AM

Git Commands

Collection of Git Commands

git clone https://repo_address.git 
git add . 
git add --all 

git commit -m "Initial commit" 

git push origin master 
git pull origin master 

git config "Jake" 

git init    [new repo in dir you are currently in] 

git --add file.txt    [adds a file that you specify for commit] 

git status 
git show    [info on last commit + diff] 

git log        [entire log] 
git log -1   [specify how many commits back] 
git log -1 --pretty=%B  [JUST the commit info] 

git reset HEAD newfile.txt   [unstage a file] 
git reset --hard HEAD  [lost everything in the current change set] 

git rm   [careful, will remove (delete) file on next commit] 

git rm --cached  [remove file from commit but doesn't delete] 

git tag -a MyTageName -m "This is my first tag" 

git branch 

git branch NewWork 

git checkout NewWork 

git checkout -b pasta [new creation at same time] 

git merge NewWork 

git diff branchname..branchname 

git stash 

git remote -v [show remote location] 

git fetch vs git pull 

git config --global push.default simple 
git config --global -l 

git mergetool 

git config --global credential.helper 

git --exec-path

Reset commits 

git add --all 

git fetch --all 

git reset --hard origin/branchname

git branch -d localBranchName [deleting a local branch]
git push origin --delete branchName [deleting a remote branch]