2.2 KiB
Git
- GitHub Flow branching strategy is used.
- Direct push to
mainbranch is prohibited. - Only merges to the
mainbranch via Pull Requests fromfeature/...orbugfix/...branches are allowed. - Tags are created for releases on the
mainbranch.
Pull Request
-
Ensure your main branch is protected, so that direct push is disabled.
-
Update the local main branch.
git checkout main git pull origin main -
Create a new branch,
feature/new-branch, with a descriptive name and switch to it.git checkout -b feature/new-branch -
Add any changes.
git add . -
Commit the changes with a message.
git commit -m "new branch: create all boiler plate files" -
Push the new branch,
feature/new-branch, to the remote Gitea repository.git push origin feature/new-branch -
Create a new Pull Request from
feature/new-branchto themainbranch. -
Review and Merge the new branch into the
mainbranch. -
Switch back to the
mainbranch.git checkout main -
Pull the latest changes that include the merged PR.
git pull origin main -
Delete the local
feature/new-branchbranch.git branch -d feature/new-branch -
Delete the remote branch after merging if Gitea did not delete it.
git push origin --delete feature/new-branch -
Create a new branch for upcoming work, for example
feature/dev.git checkout -b feature/dev
Troubleshooting
Accidentally created a commit on local main branch instead of a feature branch
-
Create a new branch pointing to the extra commit.
git branch feature/new-branch -
Reset the local
mainbranch to match the remoteorigin/main.git reset --hard origin/main -
Switch over to the new feature branch
git checkout feature/new-branch -
Push the new branch.
git push origin feature/new-branch -
Create a Pull Request.