Git Quick Reference
I don’t use Git everyday, but when I do, I use these commands, and when I do, I promptly forget them.
First set up the repo in Github then push into the remote repo.
Desired Outcome | Command | Notes |
---|---|---|
Display the version | git –version | |
Create a new local repo | git init | |
Identify yourself via name and email address and these will show up in the git commits. | git config –global user.name “Johann Bach”
git config –global user.email “johann.bach@harpsichord.com” | use git config –local to modify the local repo |
Update the index with all files in the working tree | git add –all | |
Limit how long credentials are cached. | git config credential.helper ‘cache –timeout 900’ | git config credential.helper cache git push http://example.com/repo.git Username: Password: [work for 5 more minutes] |
Store your repo credentials indefinately | git config credential.helper store | git config credential.helper store
git push http://example.com/repo.git [several days later] |
Exit git early, forgetting all cached credentials | git credential-cache exit | |
git commit -m “Insert Commit Message Here” | ||
git status | ||
git push | ||
git config credential.helper ‘store –file ~/.git-credentials’ | Research this one a bit more. | |
vi .gitconfig | ||