Skip to content

ryanzhangofficial/git-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

git-guide

A concise, copy-paste reference for everyday Git commands and workflow tips.

πŸ“ Repository Layout

git-guide/
β”œβ”€β”€ README.md   ← this guide
β”œβ”€β”€ main.java   ← minimal Java example (ProcessBuilder + Git)
└── main.py     ← minimal Python example (subprocess + Git)

πŸš€ Quick Start

# clone & enter
git clone https://github.com/ryanzhangofficial/git-guide.git
cd git-guide

# create a feature branch
git switch -c <feature>

# work β†’ stage β†’ commit
git add .
git commit -m "feat: <message>"

# sync with main before pushing
git fetch origin
git rebase origin/main   # or: git merge origin/main

# push & open PR
git push -u origin <feature>

πŸ”„ Branch Commands

Goal Command
List branches git branch -a
Rename current branch git branch -M <new>
Delete local branch git branch -d <name>
Delete remote branch git push origin --delete <name>
Switch & create (-b) git checkout -b <name> / git switch -c <name>

🏷️ Tagging Releases

# create annotated tag
git tag -a v1.0 -m "First stable release"

# push a single tag
git push origin v1.0

# delete & recreate tag
git tag -d v1.0
git push origin --delete v1.0
git tag -a v1.0 -m "Retagged v1.0"
git push origin v1.0

🧹 History Cleanup

git rebase -i HEAD~N   # squash or reword last N commits
git commit --amend     # edit most recent commit
git reflog             # recover lost refs / commits
git stash              # shelve uncommitted changes

πŸ› οΈ Script Stubs

File Purpose
main.py Demonstrates calling Git commands from Python via subprocess
main.java Same concept using Java’s ProcessBuilder

πŸ“ Contributing Guidelines

  1. Fork β†’ branch β†’ PR.
  2. Keep code comment-free (per project preference).
  3. Use commit style: <type>: <subject> where type ∈ feat, fix, docs, refactor, chore.

πŸ–‹οΈ License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors