-
-
Save irakligeek/dd210609034a9618e8cfc51d87b16070 to your computer and use it in GitHub Desktop.
Useful Git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global user.name "username" | |
git config --global user.email "email" | |
git log #shows all commits for current repo | |
git ls-files #shows all file that git tracks | |
git commit -am #adds files to staging and commits with message | |
git reset HEAD <filename> #unstages (undos) file from staging area | |
git checkout --<filename> #reset back to the last commit | |
git config --global --list #lists all configurations | |
git add -u #updates files when renaming/deleting | |
git checkout -b <branchname> #creates and switches to new branch | |
git diff <branch> <branch> #shows difference between branches | |
git merge <branch> #merges current branch to <branch> | |
git branch -d <branch> #deletes branch | |
git reset <commit ID> <option> #resets branch to previus commit | |
git remote set-url origin <github url> #sets remote url (when changed) | |
git fetch, then git pull to update local repo from the remote repo | |
git show <SHA key> shows commit history on specific commit | |
git branch -a #lists all branches | |
git pull --rebase #pulls remote repo while making sure local changes stay on top of remote commits | |
git log --oneline --graph #shows graphical interface of commits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment