Below are git commands I find myself using over and over.
Clone repository
git clone https://github.com/tinymce/tinymce-dist.git
Add existing git files to remote git repo
cd /path/to/my/repo
git remote add origin https://lostinkali@bitbucket.org/lostinkali/flightstats.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
Create a repository in existing folder
git init
git add .
# Adds the files in the local repository and stages them for commit
git commit -m "Initial commit"
Change current branch to master
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch
Delete Branch
git branch -D bugfix
Revert to previous commit
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master
adds the file to git.
git add [filename]
kills off the untracked files since the more recent commit in the log.
git clean -fd
commits the added files to git.
git commit -m "enter message here"
Remove the file git. Use -f to force the file to removed even when there are changes.
git rm file1.txt
Tagging a specific point in time.
git tag -a v1.4 -m 'my version 1.4' Author: Chuck Conway is an AI Engineer with nearly 30 years of software engineering experience. He builds practical AI systems—content pipelines, infrastructure agents, and tools that solve real problems—and shares what he’s learning along the way. Connect with him on social media: X (@chuckconway) or visit him on YouTube and on SubStack.