Use this when you want to save your local work with Git and upload it to GitHub.

1) Check what changed

git status

This shows:

  • modified files
  • new files
  • deleted files

2) Stage the files you want to include

To stage everything:

git add .

To stage one file only:

git add path/to/file

Tip: use git status again after staging so you can confirm exactly what will be committed.

3) Create a commit

git commit -m "Describe what you changed"

A commit is a saved version of your project history.

Good commit message examples:

  • Fix typo in README
  • Add intro section to github guide
  • Update animation script

4) Upload your commit to GitHub

git push

If this is your first push on a new branch, Git may ask you to set the upstream branch. In that case, run the command Git suggests, usually:

git push -u origin <branch-name>

Quick Version

git status
git add .
git commit -m "Describe what you changed"
git push

Useful Checks

See your recent commits:

git log --oneline -5

See the exact changes before committing:

git diff

See staged changes only:

git diff --cached

Common Problems

Nothing to commit

You may have forgotten to edit a file or stage it with git add.

Git says there is no upstream branch

Run:

git push -u origin <branch-name>

You committed the wrong files

Check with:

git status
git diff --cached

Then adjust before creating the commit if needed.