Here is a simple cheat sheet for some of the most common Git and GitHub commands you can use in your terminal:

  1. Initialize repository: git init
  2. Check status of working directory: git status
  3. Add files to staging area: git add <file> or git add . (to stage all changes)
  4. Commit changes: git commit -m "Your commit message"
  5. View commit history: git log
  6. Check the difference between commits: git diff
  7. Create a new branch: git branch <branch-name>
  8. Switch to a different branch: git checkout <branch-name>
  9. Merge one branch into another: git merge <branch-name>
  10. Push changes to GitHub: git push origin <branch-name>
  11. Clone a repository from GitHub: git clone https://github.com/<username>/<repository>.git
  12. Fetch remote changes: git fetch origin
  13. Pull remote changes and merge into your current branch: git pull
  14. Make a temporary change without committing it: git stash (to save the changes), git stash apply (to apply them later) or git stash pop (to both apply and delete the stashed changes).
  15. Undo your last commit: git reset HEAD~1 (this will remove the last commit but keep the changes in the working directory) or git reset <commit-hash> (to go back to a specific commit).

Updating Repository
git add .
git commit -m “comment”
git branch -M main
git push -u origin main

Merge