From 8c651a91c76dd298c2526a5adbe4a4b710a932c2 Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Sat, 25 May 2024 09:31:19 +0100 Subject: [PATCH] Add guide to set branch to push to AGit pull request by default (cherry picked from commit 5c634782b9ee089ce7f2a22c74268c111efc774d) --- docs/user/agit-support.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/user/agit-support.md b/docs/user/agit-support.md index 74d371e..58ff08e 100644 --- a/docs/user/agit-support.md +++ b/docs/user/agit-support.md @@ -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`.