Created
August 27, 2021 17:40
-
-
Save baskeboler/2915a779367707b62cd30102c9992698 to your computer and use it in GitHub Desktop.
basic git cli 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
# create repository | |
git init | |
# status | |
git status | |
# add a remote called origin with url http://somegit.com/repo/myrepo.git | |
git remote add origin http://somegit.com/repo/myrepo.git | |
# stage files | |
git add file1.txt file2.txt | |
# commit files | |
# opens up an editor to add a comment | |
git commit | |
# include the commit message in the command | |
git commit -m "this is the commit message" | |
# create a new branch called new-branch | |
git checkout -b new-branch | |
# push new branch to remote | |
git push origin new-branch | |
# merge commits from other-branch into new-branch (the currently checked out branch) | |
git merge other-branch | |
# stash uncommitted changes | |
git stash | |
# recover stashed changes | |
git stash pop | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment