0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-24 18:09:26 -05:00

Add guide to set branch to push to AGit pull request by default

This commit is contained in:
Matthias Ahouansou 2024-05-25 09:31:19 +01:00
parent cd43c8b018
commit 5c634782b9
No known key found for this signature in database

View file

@ -45,6 +45,24 @@ This can be **any** markdown content.\n
- [x] Ok"
```
To be able to easily push new commits to your pull request, you first need to switch the [default push method](https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault) to "upstream":
```shell
# To only set this option for this specific repository
git config push.default upstream
# Or run this instead if you want to set this option globally
git config --global push.default upstream
```
Then, run the following command:
```shell
git config branch.local-branch.merge refs/for/main/topic-branch
```
After doing so, you can now simply run `git push` to push commits to your pull request, without having to specify the refspec.
This also will allow you to pull, fetch, rebase, etc. from the AGit pull request by default.
#### A More Complex Example
Suppose that the currently checked out branch in your local repository is `main`, yet you would like to submit a Pull Request meant for a remote branch called `remote-branch`.