Last active
July 6, 2020 14:25
-
-
Save kkayacan/fe1779f0dbb0f6e5b7da37a88d77adee to your computer and use it in GitHub Desktop.
Git quick reference
This file contains 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
• Clone an existing remote repository to local | |
git clone https://github.com/username/project.git | |
• If starting from local (not cloning remote repo), initialize repository | |
git init | |
• Check status (changes since last commit) (optional) | |
git status | |
• Add all changes to staging (next commit). Notice "dot" at the end. | |
git add . | |
• Commit changes (create new commit). Text between double quotes is explanatory comment. | |
git commit -m "first commit" | |
• If started from local, set remote origin (repository on Github, Bitbucket, Gitlab). Remote repository must exist. | |
git remote add origin https://github.com/username/project.git | |
git remote add origin https://bitbucket.org/username/project.git | |
• If you don't want to be asked for password at every push, set for credential cache | |
Linux: | |
git config credential.helper store | |
Windows: | |
git config --global credential.helper wincred | |
• Push (upload) changes to remote origin. Git will ask for login info (user, pass). | |
git push -u origin master | |
• See local modifications | |
git diff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment