Skip to content

Instantly share code, notes, and snippets.

@mfkasim1
Created December 12, 2022 14:41
Show Gist options
  • Save mfkasim1/8b6e533a0a644ca1af5ab11b5ddd84c9 to your computer and use it in GitHub Desktop.
Save mfkasim1/8b6e533a0a644ca1af5ab11b5ddd84c9 to your computer and use it in GitHub Desktop.
Useful git commands

These are the git commands I usually use (for self-reminder), sorted from the most-used ones:

  1. git status: to see the states
  2. git log --oneline: to see which commit I'm at
  3. git add <filename(s)>: to stage a file(s)
  4. git commit -m "<Some message>": to make a commit
  5. git push: push the latest update to the remote
  6. git pull: pull the latest states from the remote
  7. git clone <repo_url>: clone a new repository
  8. git diff <filename>: to see which lines in the file that haven't been staged
  9. git add -p <filename>: to commit portion of changes in a file (y: yes, n: no, s: split into smaller chunks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment