Files
avaaz/docs/git.md
Madava 73fd4d26a5
All checks were successful
Continuous Integration / Validate and test changes (push) Successful in 3s
Update documentation
2025-12-03 01:28:28 +01:00

2.3 KiB

Git

  • GitHub Flow branching strategy is used.
  • Direct push to main branch is prohibited.
  • Only merges to the main branch via Pull Requests from feature/... or bugfix/... branches are allowed.
  • Tags v* are created for releases on the main branch.
  • Gitea configuration is available in Site Administration, User Settings, and Repository Settings.

Pull Request

  1. Ensure your main branch is protected on Gitea configuration, so that direct push is disabled.

  2. Update the local main branch.

    git checkout main
    git pull origin main
    
  3. Create a new branch, feature/new-branch, with a descriptive name and switch to it.

    git checkout -b feature/new-branch
    
  4. Add any changes.

    git add .
    
  5. Commit the changes with a message.

    git commit -m "new branch: create all boiler plate files"
    
  6. Push the new branch, feature/new-branch, to the remote Gitea repository.

    git push origin feature/new-branch
    
  7. Create a new Pull Request from feature/new-branch to the main branch.

  8. Review and Merge the new branch into the main branch.

  9. Switch back to the main branch.

    git checkout main
    
  10. Pull the latest changes that include the merged PR.

    git pull origin main
    
  11. Delete the local feature/new-branch branch.

    git branch -d feature/new-branch
    
  12. Delete the remote branch after merging if Gitea did not delete it.

    git push origin --delete feature/new-branch
    
  13. Create a new branch for upcoming work, for example feature/new-branch-2.

    git checkout -b feature/new-branch-2
    

Troubleshooting

Accidentally created a commit on local main branch instead of a feature branch

  1. Create a new branch pointing to the extra commit.

    git branch feature/new-branch
    
  2. Reset the local main branch to match the remote origin/main.

    git reset --hard origin/main
    
  3. Switch over to the new feature branch

    git checkout feature/new-branch
    
  4. Push the new branch.

    git push origin feature/new-branch
    
  5. Create a Pull Request.