Skip to content

Latest commit

 

History

History
96 lines (70 loc) · 1.54 KB

File metadata and controls

96 lines (70 loc) · 1.54 KB

Git Workflows

Follow this workflow to contribute efficiently and keep the repository clean and organized.

Table of Contents

  1. sync main
  2. create feature branch
  3. work & commit
  4. push changes
  5. pull request & code review
  6. integration (once approved)
  7. push
  8. cleanup (after merge)

0) sync main

git switch main
git pull --ff-only --prune

1) create feature branch

git switch -c BRANCH_NAME

2) work & commit

git add FILES
git commit -m "COMMIT_MSG"

(Optional: fix up past commit)

git add FILES
git commit --fixup=COMMIT_SHA
git fetch origin
git rebase -i --autosquash origin/main

3) push changes

git fetch origin
git rebase -i origin/main
git push --force-with-lease origin BRANCH_NAME

4) pull request & code review

  1. Open a PR on GitHub
  2. Ensure CI passes
  3. Request reviews

5) integration (once approved)

git switch main
git pull --ff-only
git merge --ff-only origin/BRANCH_NAME

If --ff-only refuses:

git switch BRANCH_NAME
git rebase main
git switch main
git merge --ff-only BRANCH_NAME

(Or use GitHub “Rebase & merge” button.)

6) push

git push origin main

7) cleanup (after merge)

git push origin --delete "BRANCH_NAME"
git branch -d "BRANCH_NAME"
git fetch --prune

(Optional)

git gc --prune=now