Git Reference

Git is a version control system used to track changes, collaborate with others, and keep project history organized.

Common Workflow

# check current changes
git status

# stage files
git add .

# create a commit
git commit -m "Add Git reference page"

# push to GitHub
git push

Useful Commands

Check Project Status

git status

Shows changed, staged, and untracked files.

See File Changes

git diff

Shows unstaged changes before you commit them.

git diff --staged

Shows staged changes that will be included in the next commit.

Create A Branch

git switch -c new-feature

Creates and switches to a new branch.

Switch Branches

git switch main

Moves back to the main branch.

View Commit History

git log --oneline

Shows a short list of previous commits.

Pull Latest Changes

git pull

Downloads and merges the latest changes from GitHub.

Push Local Commits

git push

Uploads local commits to GitHub.

Git Articles

GitHub Pages Notes

For a folder to appear as a page on this site, add an index.md or index.html file inside it.

Example:

git/
  index.md

This page will be available at:

https://edengoforit.github.io/git/

Sources

Back to Home