GIT for dummys
2021-03-17 - psic4t
I use git only occasionally. Here are some basic commands to remember:
- git init # new repo
- git add *.go # add some files
- git commit -a -m "First commit" # make a commit
- git status # check for uncommitted changes
- git log # show commits, "--all" for all
- git diff
# shows changes - git checkout
# checkout different commit - git master # back to master
- git remote add origin git@git.sr.ht:~psic4t/bla # setup remote repo
- git push -u origin master # push to remote repo
- git tag -a "0.8.4" # tag release
- git push origin "0.8.4" # push tag to remote repo
- git clone git@github.com:mygitname/theproject.git --branch 1.0.2 # clone specific release
- git commit --amend # change last commit message
- git revert HEAD # revert last commit but keep that commit in history