Create an empty git repo or reinitialize an existing one
$ git initCreate an empty git repo or reinitialize an existing one
$ git initThe git command-line utility has plenty of inconsistencies http://steveko.wordpress.com/2012/02/24/10-things-i-hate-about-git/
A GUI like http://sourcetreeapp.com is often helpful, but staying on the command line usually quicker. This is a list of the commands I use most frequently, listed by functional category:
git status list which (unstaged) files have changed
Visit my blog or connect with me on Twitter
git init
or
Press minus + shift + s and return to chop/fold long lines!
Initialize a git repo in the current directory
# git init
Add a remote called "origin"
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amendThis will open your $EDITOR and let you change the message. Continue with your usual git push origin master.
# make sure to replace `<hash>` with your gist's hash
git clone https://gist.github.com/<hash>.git # with https
git clone [email protected]:<hash>.git # or with ssh| Visual Studio 2019 Enterprise | |
| BF8Y8-GN2QH-T84XB-QVY3B-RC4DF | |
| Visual Studio 2019 Professional | |
| NYWVH-HT4XC-R2WYW-9Y3CM-X4V3Y |
| # adding and committing | |
| git add -A # stages All | |
| git add . # stages new and modified, without deleted | |
| git add -u # stages modified and deleted, without new | |
| git commit --amend # Add staged changes to previous commit. Do not use if commit has been pushed. | |
| git commit --amend --no-edit # Do so without having to edit the commit message. | |
| # remotes - pushing, pulling, and tracking | |
| git fetch # gets remote objects and refs. Needed if new branches were added on the remote. | |
| git remote -v # Lists all remotes (verbose) |