Repository: VirtusLab/git-machete
Pull request #1365 (2024-11-02 14:04:46)

Add `git machete gith{hub,lab} {restack,retarget}-{pr,mr} --update-related-descriptions` flags

codecov-commenter: ## [Codecov](https://app.codecov.io/gh/VirtusLab/git-machete/pull/1365?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=VirtusLab) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 98.46%. Comparing base [(`cf46188`)](https://app.codecov.io/gh/VirtusLab/git-machete/commit/cf46188a04aa2ed1d9848ad01fee33b05bb5b253?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=VirtusLab) to head [(`d13c4b6`)](https://app.codecov.io/gh/VirtusLab/git-machete/commit/d13c4b633c6e851175ed7d88acfd836d8d3d9d5d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=VirtusLab).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff            @@
##           develop    #1365   +/-   ##
========================================
  Coverage    98.46%   98.46%           
========================================
  Files           14       14           
  Lines         3963     3963           
  Branches       779      779           
========================================
  Hits          3902     3902           
  Misses          39       39           
  Partials        22       22           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/VirtusLab/git-machete/pull/1365?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=VirtusLab).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=VirtusLab).


Patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 74ab82d..a826a51 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,6 +4,8 @@
 
 - added: `git machete git{hub,lab} update-{pr,mr}-descriptions` subcommands
 - added: `git machete gith{hub,lab} create-{pr,mr} --update-related-descriptions` flags
+- added: `git machete gith{hub,lab} restack-{pr,mr} --update-related-descriptions` flags
+- added: `git machete gith{hub,lab} retarget-{pr,mr} --update-related-descriptions` flags
 - added: `machete.traverse.fetch.<remote>` git config key to selectively exclude remotes from `git machete traverse --fetch` (contributed by @gjulianm)
 
 ## New in git-machete 3.30.0
diff --git a/completion/git-machete.completion.bash b/completion/git-machete.completion.bash
index 41d32ca..3f10474 100644
--- a/completion/git-machete.completion.bash
+++ b/completion/git-machete.completion.bash
@@ -25,7 +25,8 @@ _git_machete() {
   local githublab_anno_opts="--with-urls"
   local githublab_create_opts="--draft --title= -U --update-related-descriptions --yes"
   local githublab_checkout_opts="--all --by= --mine"
-  local githublab_retarget_opts="-b --branch= --ignore-if-missing"
+  local githublab_restack_opts="-U --update-related-descriptions"
+  local githublab_retarget_opts="-b --branch= --ignore-if-missing -U --update-related-descriptions"
   local githublab_update_descriptions_opts="--all --mine --related"
   local reapply_opts="-f --fork-point="
   local slide_out_opts="-d --down-fork-point= --delete -M --merge -n --no-edit-merge --no-interactive-rebase --removed-from-remote"
@@ -53,33 +54,25 @@ _git_machete() {
         discover) __gitcomp "$common_opts $discover_opts" ;;
         fork-point) __gitcomp "$common_opts $fork_point_opts" ;;
         github)
-          if [[ ${COMP_WORDS[3]} == "anno-prs" ]]; then
-            __gitcomp "$common_opts $githublab_anno_opts"
-          elif [[ ${COMP_WORDS[3]} == "create-pr" ]]; then
-            __gitcomp "$common_opts $githublab_create_opts"
-          elif [[ ${COMP_WORDS[3]} == "checkout-prs" ]]; then
-            __gitcomp "$common_opts $githublab_checkout_opts"
-          elif [[ ${COMP_WORDS[3]} == "retarget-pr" ]]; then
-            __gitcomp "$common_opts $githublab_retarget_opts"
-          elif [[ ${COMP_WORDS[3]} == "update-pr-descriptions" ]]; then
-            __gitcomp "$common_opts $githublab_update_descriptions_opts"
-          else
-            __gitcomp "$common_opts"
-          fi ;;
+          case ${COMP_WORDS[3]} in
+            "anno-prs") __gitcomp "$common_opts $githublab_anno_opts" ;;
+            "create-pr") __gitcomp "$common_opts $githublab_create_opts" ;;
+            "checkout-prs") __gitcomp "$common_opts $githublab_checkout_opts" ;;
+            "restack-pr") __gitcomp "$common_opts $githublab_restack_opts" ;;
+            "retarget-pr") __gitcomp "$common_opts $githublab_retarget_opts" ;;
+            "update-pr-descriptions") __gitcomp "$common_opts $githublab_update_descriptions_opts" ;;
+            *) __gitcomp "$common_opts" ;;
+          esac ;;
         gitlab)
-          if [[ ${COMP_WORDS[3]} == "anno-mrs" ]]; then
-            __gitcomp "$common_opts $githublab_anno_opts"
-          elif [[ ${COMP_WORDS[3]} == "create-mr" ]]; then
-            __gitcomp "$common_opts $githublab_create_opts"
-          elif [[ ${COMP_WORDS[3]} == "checkout-mrs" ]]; then
-            __gitcomp "$common_opts $githublab_checkout_opts"
-          elif [[ ${COMP_WORDS[3]} == "retarget-mr" ]]; then
-            __gitcomp "$common_opts $githublab_retarget_opts"
-          elif [[ ${COMP_WORDS[3]} == "update-mr-descriptions" ]]; then
-            __gitcomp "$common_opts $githublab_update_descriptions_opts"
-          else
-            __gitcomp "$common_opts"
-          fi ;;
+          case ${COMP_WORDS[3]} in
+            "anno-mrs") __gitcomp "$common_opts $githublab_anno_opts" ;;
+            "create-mr") __gitcomp "$common_opts $githublab_create_opts" ;;
+            "checkout-mrs") __gitcomp "$common_opts $githublab_checkout_opts" ;;
+            "restack-mr") __gitcomp "$common_opts $githublab_restack_opts" ;;
+            "retarget-mr") __gitcomp "$common_opts $githublab_retarget_opts" ;;
+            "update-mr-descriptions") __gitcomp "$common_opts $githublab_update_descriptions_opts" ;;
+            *) __gitcomp "$common_opts" ;;
+          esac ;;
         reapply) __gitcomp "$common_opts $reapply_opts" ;;
         slide-out) __gitcomp "$common_opts $slide_out_opts" ;;
         squash) __gitcomp "$common_opts $squash_opts" ;;
@@ -133,34 +126,30 @@ _git_machete() {
               github)
                 if [[ $COMP_CWORD -eq 3 ]]; then
                   __gitcomp "$github_subcommands"
-                elif [[ ${COMP_WORDS[3]} == "anno-prs" ]]; then
-                  __gitcomp "$common_opts $githublab_anno_opts"
-                elif [[ ${COMP_WORDS[3]} == "create-pr" ]]; then
-                  __gitcomp "$common_opts $githublab_create_opts"
-                elif [[ ${COMP_WORDS[3]} == "checkout-prs" ]]; then
-                  __gitcomp "$common_opts $githublab_checkout_opts"
-                elif [[ ${COMP_WORDS[3]} == "retarget-pr" ]]; then
-                  __gitcomp "$common_opts $githublab_retarget_opts"
-                elif [[ ${COMP_WORDS[3]} == "update-pr-descriptions" ]]; then
-                  __gitcomp "$common_opts $githublab_update_descriptions_opts"
                 else
-                  COMPREPLY=('')
+                  case ${COMP_WORDS[3]} in
+                    "anno-prs") __gitcomp "$common_opts $githublab_anno_opts" ;;
+                    "create-pr") __gitcomp "$common_opts $githublab_create_opts" ;;
+                    "checkout-prs") __gitcomp "$common_opts $githublab_checkout_opts" ;;
+                    "restack-pr") __gitcomp "$common_opts $githublab_restack_opts" ;;
+                    "retarget-pr") __gitcomp "$common_opts $githublab_retarget_opts" ;;
+                    "update-pr-descriptions") __gitcomp "$common_opts $githublab_update_descriptions_opts" ;;
+                    *) COMPREPLY=('') ;;
+                  esac
                 fi ;;
               gitlab)
                 if [[ $COMP_CWORD -eq 3 ]]; then
                   __gitcomp "$gitlab_subcommands"
-                elif [[ ${COMP_WORDS[3]} == "anno-mrs" ]]; then
-                  __gitcomp "$common_opts $githublab_anno_opts"
-                elif [[ ${COMP_WORDS[3]} == "create-mr" ]]; then
-                  __gitcomp "$common_opts $githublab_create_opts"
-                elif [[ ${COMP_WORDS[3]} == "checkout-mrs" ]]; then
-                  __gitcomp "$common_opts $githublab_checkout_opts"
-                elif [[ ${COMP_WORDS[3]} == "retarget-mr" ]]; then
-                  __gitcomp "$common_opts $githublab_retarget_opts"
-                elif [[ ${COMP_WORDS[3]} == "update-mr-descriptions" ]]; then
-                  __gitcomp "$common_opts $githublab_update_descriptions_opts"
                 else
-                  COMPREPLY=('')
+                  case ${COMP_WORDS[3]} in
+                    "anno-mrs") __gitcomp "$common_opts $githublab_anno_opts" ;;
+                    "create-mr") __gitcomp "$common_opts $githublab_create_opts" ;;
+                    "checkout-mrs") __gitcomp "$common_opts $githublab_checkout_opts" ;;
+                    "restack-mr") __gitcomp "$common_opts $githublab_restack_opts" ;;
+                    "retarget-mr") __gitcomp "$common_opts $githublab_retarget_opts" ;;
+                    "update-mr-descriptions") __gitcomp "$common_opts $githublab_update_descriptions_opts" ;;
+                    *) COMPREPLY=('') ;;
+                  esac
                 fi ;;
               help)
                 if [[ $COMP_CWORD -eq 3 ]]; then
diff --git a/completion/git-machete.completion.zsh b/completion/git-machete.completion.zsh
index 36270ca..99b3ceb 100644
--- a/completion/git-machete.completion.zsh
+++ b/completion/git-machete.completion.zsh
@@ -285,10 +285,17 @@ __git_machete_github_subcommands() {
             "${common_flags[@]}"
         ;;
 
+        (restack-pr)
+          _arguments \
+            '(-U --update-related-descriptions)'{-U,--update-related-descriptions}'[Update the generated sections of PR descriptions that list the upstream and/or downstream PRs]' \
+            "${common_flags[@]}"
+        ;;
+
         (retarget-pr)
           _arguments \
             '(-b --branch)'{-b,--branch=}'[Specify the branch for which the associated PR base will be set to its upstream (parent) branch]: :__git_machete_list_managed' \
             '(--ignore-if-missing)'--ignore-if-missing'[Ignore errors and quietly terminate execution if there is no PR opened for current (or specified) branch]' \
+            '(-U --update-related-descriptions)'{-U,--update-related-descriptions}'[Update the generated sections of PR descriptions that list the upstream and/or downstream PRs]' \
             "${common_flags[@]}"
         ;;
 
@@ -353,10 +360,17 @@ __git_machete_gitlab_subcommands() {
             "${common_flags[@]}"
         ;;
 
+        (restack-mr)
+          _arguments \
+            '(-U --update-related-descriptions)'{-U,--update-related-descriptions}'[Update the generated sections of MR descriptions that list the upstream and/or downstream MRs]' \
+            "${common_flags[@]}"
+        ;;
+
         (retarget-mr)
           _arguments \
             '(-b --branch)'{-b,--branch=}'[Specify the branch for which the associated MR source branch will be set to its upstream (parent) branch]: :__git_machete_list_managed' \
             '(--ignore-if-missing)'--ignore-if-missing'[Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch]' \
+            '(-U --update-related-descriptions)'{-U,--update-related-descriptions}'[Update the generated sections of MR descriptions that list the upstream and/or downstream MRs]' \
             "${common_flags[@]}"
         ;;
 
diff --git a/completion/git-machete.fish b/completion/git-machete.fish
index 9706d28..7cd803f 100644
--- a/completion/git-machete.fish
+++ b/completion/git-machete.fish
@@ -108,8 +108,10 @@ complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from create-pr;              and not __fish_seen_subcommand_from --title"                       -x -l title                                                -d 'Set the title for new PR explicitly'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from create-pr;              and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of PR descriptions that list the upstream and/or downstream PRs'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from create-pr;              and not __fish_seen_subcommand_from --yes"                         -f -l yes                                                  -d 'Do not ask for confirmation whether to push the branch'
+complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from restack-pr;             and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of PR descriptions that list the upstream and/or downstream PRs'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from retarget-pr;            and not __fish_seen_subcommand_from --branch"                      -x -l branch -s b       -a '(__machete_managed_branches)'  -d 'Specify the branch for which the associated PR base will be set to its upstream (parent) branch'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from retarget-pr;            and not __fish_seen_subcommand_from --ignore-if-missing"           -f -l ignore-if-missing                                    -d 'Ignore errors and quietly terminate execution if there is no PR opened for current (or specified) branch'
+complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from retarget-pr;            and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of PR descriptions that list the upstream and/or downstream PRs'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from update-pr-descriptions; and not __fish_seen_subcommand_from --all"                         -f -l all                                                  -d 'Update PR descriptions for all PRs in the repository'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from update-pr-descriptions; and not __fish_seen_subcommand_from --mine"                        -x -l mine                                                 -d 'Update PR descriptions for all PRs opened by the current user associated with the GitHub token'
 complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_subcommand_from update-pr-descriptions; and not __fish_seen_subcommand_from --related"                     -x -l related                                              -d 'Update PR descriptions for all PRs that are upstream and/or downstream of the PR for the current branch'
@@ -130,8 +132,10 @@ complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from create-mr;              and not __fish_seen_subcommand_from --title"                       -x -l title                                                -d 'Set the title for new MR explicitly'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from create-mr;              and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of MR descriptions that list the upstream and/or downstream MRs'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from create-mr;              and not __fish_seen_subcommand_from --yes"                         -f -l yes                                                  -d 'Do not ask for confirmation whether to push the branch'
+complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from restack-mr;             and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of MR descriptions that list the upstream and/or downstream MRs'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from retarget-mr;            and not __fish_seen_subcommand_from --branch"                      -x -l branch -s b       -a '(__machete_managed_branches)'  -d 'Specify the branch for which the associated MR source branch will be set to its upstream (parent) branch'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from retarget-mr;            and not __fish_seen_subcommand_from --ignore-if-missing"           -f -l ignore-if-missing                                    -d 'Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch'
+complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from retarget-mr;            and not __fish_seen_subcommand_from --update-related-descriptions" -f -l update-related-descriptions -s U                     -d 'Update the generated sections of MR descriptions that list the upstream and/or downstream MRs'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from update-mr-descriptions; and not __fish_seen_subcommand_from --all"                         -f -l all                                                  -d 'Update MR descriptions for all MRs in the project'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from update-mr-descriptions; and not __fish_seen_subcommand_from --mine"                        -x -l mine                                                 -d 'Update MR descriptions for all MRs opened by the current user associated with the GitHub token'
 complete -c git-machete -n "__fish_seen_subcommand_from gitlab; and __fish_seen_subcommand_from update-mr-descriptions; and not __fish_seen_subcommand_from --related"                     -x -l related                                              -d 'Update MR descriptions for all MRs that are upstream and/or downstream of the MR for the current branch'
diff --git a/docs/man/git-machete.1 b/docs/man/git-machete.1
index f3d4493..10873f1 100644
--- a/docs/man/git-machete.1
+++ b/docs/man/git-machete.1
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
 ..
-.TH "GIT-MACHETE" "1" "Nov 06, 2024" "" "git-machete"
+.TH "GIT-MACHETE" "1" "Nov 07, 2024" "" "git-machete"
 .SH NAME
 git-machete \- git-machete 3.31.0
 .sp
@@ -1030,7 +1030,7 @@ See help for \fBgit machete github update\-pr\-descriptions \-\-related\fP for d
 Do not ask for confirmation whether to push the branch.
 .UNINDENT
 .TP
-.B \fBrestack\-pr\fP:
+.B \fBrestack\-pr [\-U|\-\-update\-related\-descriptions]\fP:
 Perform the following sequence of actions:
 .INDENT 7.0
 .IP 1. 3
@@ -1045,8 +1045,16 @@ If the PR has been converted to draft in step 1, it\(aqs reverted to ready for r
 .sp
 The drafting/undrafting is useful in case the GitHub repository has set up \X'tty: link https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners'\fI\%CODEOWNERS\fP\X'tty: link'\&.
 Draft PRs don\(aqt get code owners automatically added as reviewers.
+.sp
+\fBOptions:\fP
+.INDENT 7.0
+.TP
+.B  \-U\fP,\fB  \-\-update\-related\-descriptions
+Update the generated sections (\(dqintros\(dq) of PR descriptions that list the upstream and/or downstream PRs.
+See help for \fBgit machete github update\-pr\-descriptions \-\-related\fP for details.
+.UNINDENT
 .TP
-.B \fBretarget\-pr [\-b|\-\-branch=<branch>] [\-\-ignore\-if\-missing]\fP:
+.B \fBretarget\-pr [\-b|\-\-branch=<branch>] [\-\-ignore\-if\-missing] [\-U|\-\-update\-related\-descriptions]\fP:
 Sets the base of the current (or specified) branch\(aqs PR to upstream (parent) branch, as seen by git machete (see \fBgit machete show up\fP).
 .sp
 If after changing the base the PR ends up stacked atop another PR, the PR description posted to GitHub will include
@@ -1062,6 +1070,10 @@ Specify the branch for which the associated PR base will be set to its upstream
 .TP
 .B  \-\-ignore\-if\-missing
 Ignore errors and quietly terminate execution if there is no PR opened for current (or specified) branch.
+.TP
+.B  \-U\fP,\fB  \-\-update\-related\-descriptions
+Update the generated sections (\(dqintros\(dq) of PR descriptions that list the upstream and/or downstream PRs.
+See help for \fBgit machete github update\-pr\-descriptions \-\-related\fP for details.
 .UNINDENT
 .TP
 .B \fBsync\fP:
@@ -1168,7 +1180,7 @@ git machete gitlab <subcommand>
 .UNINDENT
 .UNINDENT
 .sp
-where \fB<subcommand>\fP is one of: \fBanno\-mrs\fP, \fBcheckout\-mrs\fP, \fBcreate\-mr\fP, \fBretarget\-mr\fP or \fBrestack\-mr\fP\&.
+where \fB<subcommand>\fP is one of: \fBanno\-mrs\fP, \fBcheckout\-mrs\fP, \fBcreate\-mr\fP, \fBretarget\-mr\fP, \fBrestack\-mr\fP or \fBupdate\-mr\-descriptions\fP\&.
 .sp
 Creates, checks out and manages GitLab MRs while keeping them reflected in branch layout file.
 .sp
@@ -1293,7 +1305,7 @@ See help for \fBgit machete gitlab update\-mr\-descriptions \-\-related\fP for d
 Do not ask for confirmation whether to push the branch.
 .UNINDENT
 .TP
-.B \fBrestack\-mr\fP:
+.B \fBrestack\-mr [\-U|\-\-update\-related\-descriptions]\fP:
 Perform the following sequence of actions:
 .INDENT 7.0
 .IP 1. 3
@@ -1308,8 +1320,16 @@ If the MR has been converted to draft in step 1, it\(aqs reverted to ready for r
 .sp
 The drafting/undrafting is useful in case the GitLab project has set up \X'tty: link https://docs.gitlab.com/ee/user/project/codeowners/'\fI\%code owners\fP\X'tty: link'\&.
 Draft MRs don\(aqt get code owners automatically added as reviewers.
+.sp
+\fBOptions:\fP
+.INDENT 7.0
+.TP
+.B  \-U\fP,\fB  \-\-update\-related\-descriptions
+Update the generated sections (\(dqintros\(dq) of MR descriptions that list the upstream and/or downstream MRs.
+See help for \fBgit machete gitlab update\-mr\-descriptions \-\-related\fP for details.
+.UNINDENT
 .TP
-.B \fBretarget\-mr [\-b|\-\-branch=<branch>] [\-\-ignore\-if\-missing]\fP:
+.B \fBretarget\-mr [\-b|\-\-branch=<branch>] [\-\-ignore\-if\-missing] [\-U|\-\-update\-related\-descriptions]\fP:
 Sets the target of the current (or specified) branch\(aqs MR to upstream (parent) branch, as seen by git machete (see \fBgit machete show up\fP).
 .sp
 If after changing the base the MR ends up stacked atop another MR, the MR description posted to GitLab will include
@@ -1325,6 +1345,10 @@ Specify the branch for which the associated MR source branch will be set to its
 .TP
 .B  \-\-ignore\-if\-missing
 Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch.
+.TP
+.B  \-U\fP,\fB  \-\-update\-related\-descriptions
+Update the generated sections (\(dqintros\(dq) of MR descriptions that list the upstream and/or downstream MRs.
+See help for \fBgit machete gitlab update\-mr\-descriptions \-\-related\fP for details.
 .UNINDENT
 .TP
 .B \fBupdate\-mr\-descriptions\fP:
diff --git a/docs/source/cli/github.rst b/docs/source/cli/github.rst
index e7d5202..9ee56b9 100644
--- a/docs/source/cli/github.rst
+++ b/docs/source/cli/github.rst
@@ -103,7 +103,7 @@ Creates, checks out and manages GitHub PRs while keeping them reflected in branc
 
     --yes                              Do not ask for confirmation whether to push the branch.
 
-``restack-pr``:
+``restack-pr [-U|--update-related-descriptions]``:
     Perform the following sequence of actions:
 
     #. If the PR for the current branch is ready for review, it gets converted to a draft.
@@ -114,7 +114,12 @@ Creates, checks out and manages GitHub PRs while keeping them reflected in branc
     The drafting/undrafting is useful in case the GitHub repository has set up `CODEOWNERS <https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners>`_.
     Draft PRs don't get code owners automatically added as reviewers.
 
-``retarget-pr [-b|--branch=<branch>] [--ignore-if-missing]``:
+    **Options:**
+
+    -U, --update-related-descriptions  Update the generated sections ("intros") of PR descriptions that list the upstream and/or downstream PRs.
+                                       See help for ``git machete github update-pr-descriptions --related`` for details.
+
+``retarget-pr [-b|--branch=<branch>] [--ignore-if-missing] [-U|--update-related-descriptions]``:
     Sets the base of the current (or specified) branch's PR to upstream (parent) branch, as seen by git machete (see ``git machete show up``).
 
     If after changing the base the PR ends up stacked atop another PR, the PR description posted to GitHub will include
@@ -128,6 +133,9 @@ Creates, checks out and manages GitHub PRs while keeping them reflected in branc
 
     --ignore-if-missing                Ignore errors and quietly terminate execution if there is no PR opened for current (or specified) branch.
 
+    -U, --update-related-descriptions  Update the generated sections ("intros") of PR descriptions that list the upstream and/or downstream PRs.
+                                       See help for ``git machete github update-pr-descriptions --related`` for details.
+
 ``sync``:
     **Deprecated.** Use ``github checkout-prs --mine``, ``delete-unmanaged`` and ``slide-out --removed-from-remote``.
 
diff --git a/docs/source/cli/gitlab.rst b/docs/source/cli/gitlab.rst
index 5c2dc79..d725d2c 100644
--- a/docs/source/cli/gitlab.rst
+++ b/docs/source/cli/gitlab.rst
@@ -8,7 +8,7 @@ gitlab
 
     git machete gitlab <subcommand>
 
-where ``<subcommand>`` is one of: ``anno-mrs``, ``checkout-mrs``, ``create-mr``, ``retarget-mr`` or ``restack-mr``.
+where ``<subcommand>`` is one of: ``anno-mrs``, ``checkout-mrs``, ``create-mr``, ``retarget-mr``, ``restack-mr`` or ``update-mr-descriptions``.
 
 Creates, checks out and manages GitLab MRs while keeping them reflected in branch layout file.
 
@@ -104,7 +104,7 @@ Creates, checks out and manages GitLab MRs while keeping them reflected in branc
 
     --yes                              Do not ask for confirmation whether to push the branch.
 
-``restack-mr``:
+``restack-mr [-U|--update-related-descriptions]``:
     Perform the following sequence of actions:
 
     #. If the MR for the current branch is ready for review, it gets converted to a draft.
@@ -115,7 +115,12 @@ Creates, checks out and manages GitLab MRs while keeping them reflected in branc
     The drafting/undrafting is useful in case the GitLab project has set up `code owners <https://docs.gitlab.com/ee/user/project/codeowners/>`_.
     Draft MRs don't get code owners automatically added as reviewers.
 
-``retarget-mr [-b|--branch=<branch>] [--ignore-if-missing]``:
+    **Options:**
+
+    -U, --update-related-descriptions  Update the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs.
+                                       See help for ``git machete gitlab update-mr-descriptions --related`` for details.
+
+``retarget-mr [-b|--branch=<branch>] [--ignore-if-missing] [-U|--update-related-descriptions]``:
     Sets the target of the current (or specified) branch's MR to upstream (parent) branch, as seen by git machete (see ``git machete show up``).
 
     If after changing the base the MR ends up stacked atop another MR, the MR description posted to GitLab will include
@@ -125,9 +130,12 @@ Creates, checks out and manages GitLab MRs while keeping them reflected in branc
 
     **Options:**
 
-    -b, --branch=<branch>     Specify the branch for which the associated MR source branch will be set to its upstream (parent) branch. The current branch is used if the option is absent.
+    -b, --branch=<branch>              Specify the branch for which the associated MR source branch will be set to its upstream (parent) branch. The current branch is used if the option is absent.
+
+    --ignore-if-missing                Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch.
 
-    --ignore-if-missing       Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch.
+    -U, --update-related-descriptions  Update the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs.
+                                       See help for ``git machete gitlab update-mr-descriptions --related`` for details.
 
 ``update-mr-descriptions``:
     Updates the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs
diff --git a/git_machete/cli.py b/git_machete/cli.py
index 48060b1..4414a9e 100644
--- a/git_machete/cli.py
+++ b/git_machete/cli.py
@@ -766,8 +766,10 @@ def launch(orig_args: List[str]) -> None:
                 raise MacheteException(f"`--related` option is only valid with `update-{pr_or_mr}-descriptions` subcommand.")
             if cli_opts.opt_title is not None and subcommand != f"create-{pr_or_mr}":
                 raise MacheteException(f"`--title` option is only valid with `create-{pr_or_mr}` subcommand.")
-            if cli_opts.opt_update_related_descriptions and subcommand != f"create-{pr_or_mr}":
-                raise MacheteException(f"`--update-related-descriptions` option is only valid with `create-{pr_or_mr}` subcommand.")
+            if (cli_opts.opt_update_related_descriptions and
+                    subcommand not in (f"create-{pr_or_mr}", f"restack-{pr_or_mr}", f"retarget-{pr_or_mr}")):
+                raise MacheteException(f"`--update-related-descriptions` option is only valid "
+                                       f"with `create-{pr_or_mr}`, `restack-{pr_or_mr}` and `retarget-{pr_or_mr}` subcommands.")
             if cli_opts.opt_with_urls and subcommand != f"anno-{pr_or_mr}s":
                 raise MacheteException(f"`--with-urls` option is only valid with `anno-{pr_or_mr}s` subcommand.")
             if cli_opts.opt_yes and subcommand != f"create-{pr_or_mr}":
@@ -798,12 +800,16 @@ def launch(orig_args: List[str]) -> None:
                     opt_update_related_descriptions=cli_opts.opt_update_related_descriptions,
                     opt_yes=cli_opts.opt_yes)
             elif subcommand == f"restack-{pr_or_mr}":
-                machete_client.restack_pull_request(spec)
+                machete_client.restack_pull_request(spec, opt_update_related_descriptions=cli_opts.opt_update_related_descriptions)
             elif subcommand == f"retarget-{pr_or_mr}":
                 branch = parsed_cli.branch if 'branch' in parsed_cli else git.get_current_branch()
                 machete_client.expect_in_managed_branches(branch)
-                ignore_if_missing = cli_opts.opt_ignore_if_missing
-                machete_client.retarget_pr(spec, head=branch, ignore_if_missing=ignore_if_missing)
+                machete_client.retarget_pull_request(
+                    spec,
+                    head=branch,
+                    opt_ignore_if_missing=cli_opts.opt_ignore_if_missing,
+                    opt_update_related_descriptions=cli_opts.opt_update_related_descriptions
+                )
             elif subcommand == "sync":  # GitHub only
                 machete_client.checkout_pull_requests(spec, pr_numbers=[], mine=True)
                 machete_client.delete_unmanaged(opt_squash_merge_detection=SquashMergeDetection.NONE, opt_yes=False)
diff --git a/git_machete/client.py b/git_machete/client.py
index 695c5d7..b971c95 100644
--- a/git_machete/client.py
+++ b/git_machete/client.py
@@ -2198,16 +2198,17 @@ class MacheteClient:
 
         if related:
             head = self.__git.get_current_branch()
-            current_pr = self.__get_sole_pull_request_for_head(head, ignore_if_missing=False)
+            related_to = self.__get_sole_pull_request_for_head(head, ignore_if_missing=False)
         else:
-            current_pr = None
+            related_to = None
         applicable_prs: List[PullRequest] = self.__get_applicable_pull_requests(
-            pr_numbers=[], all=all, mine=mine, by=None, related_to=current_pr, user=current_user)
+            all=all, by=current_user if mine else None, related_to=related_to)
 
         for pr in applicable_prs:
             new_description = self.__get_updated_pull_request_description(pr)
             if pr.description != new_description:
                 self.code_hosting_client.set_description_of_pull_request(pr.number, description=new_description)
+                pr.description = new_description
                 print(fmt(f'Description of {pr.display_text()} (<b>{pr.head} {get_right_arrow()} {pr.base}</b>) has been updated'))
 
     def checkout_pull_requests(self,
@@ -2230,9 +2231,11 @@ class MacheteClient:
             else:
                 warn(msg)
                 return
+        if mine:
+            by = current_user
 
         applicable_prs: List[PullRequest] = self.__get_applicable_pull_requests(
-            pr_numbers, all=all, mine=mine, by=by, related_to=None, user=current_user)
+            pr_numbers=pr_numbers, all=all, by=by)
 
         debug(f'organization is {org_repo_remote.organization}, repository is {org_repo_remote.repository}')
         self.__git.fetch_remote(org_repo_remote.remote)
@@ -2336,12 +2339,11 @@ class MacheteClient:
 
     def __get_applicable_pull_requests(
             self,
-            pr_numbers: Optional[List[int]],
-            all: bool,
-            mine: bool,
-            related_to: Optional[PullRequest],
-            by: Optional[str],
-            user: Optional[str]
+            *,
+            pr_numbers: Optional[List[int]] = None,
+            all: bool = False,
+            by: Optional[str] = None,
+            related_to: Optional[PullRequest] = None
     ) -> List[PullRequest]:
         result: List[PullRequest] = []
         spec = self.code_hosting_spec
@@ -2366,12 +2368,6 @@ class MacheteClient:
                 warn(f"Currently there are no {spec.pr_full_name}s opened in {repo_pretty}")
                 return []
             return all_open_prs
-        elif mine and user:
-            result = [pr for pr in all_open_prs if pr.user == user]
-            if not result:
-                warn(f"Current user {bold(user)} has no open {spec.pr_full_name} in {repo_pretty}")
-                return []
-            return result
         elif by:
             result = [pr for pr in all_open_prs if pr.user == by]
             if not result:
@@ -2403,7 +2399,7 @@ class MacheteClient:
                 return remote
         return None
 
-    def restack_pull_request(self, spec: CodeHostingSpec) -> None:
+    def restack_pull_request(self, spec: CodeHostingSpec, opt_update_related_descriptions: bool) -> None:
         head = self.__git.get_current_branch()
         _, org_repo_remote = self.__init_code_hosting_client(spec, branch_used_for_tracking_data=head)
 
@@ -2431,7 +2427,8 @@ class MacheteClient:
                 print(f'{pr.display_text()} has been temporarily marked as draft')
 
             # Note that retarget should happen BEFORE push, see issue #1222
-            self.retarget_pr(spec, head, ignore_if_missing=False)
+            self.retarget_pull_request(spec, head, opt_ignore_if_missing=False,
+                                       opt_update_related_descriptions=opt_update_related_descriptions)
 
             if s == SyncToRemoteStatus.AHEAD_OF_REMOTE:
                 assert remote is not None
@@ -2483,7 +2480,8 @@ class MacheteClient:
             else:  # case handled elsewhere
                 raise UnexpectedMacheteException(f"Could not retarget {spec.pr_full_name}: invalid sync-to-remote status `{s}`.")
 
-            self.retarget_pr(spec, head, ignore_if_missing=False)
+            self.retarget_pull_request(spec, head, opt_ignore_if_missing=False,
+                                       opt_update_related_descriptions=opt_update_related_descriptions)
 
     def __get_updated_pull_request_description(self, pr: PullRequest) -> str:
         def skip_leading_empty(strs: List[str]) -> List[str]:
@@ -2505,10 +2503,13 @@ class MacheteClient:
             lines = lines_to_prepend + ([''] if lines_to_prepend else []) + skip_leading_empty(lines)
         return '\n'.join(lines)
 
-    def retarget_pr(self, spec: CodeHostingSpec, head: LocalBranchShortName, ignore_if_missing: bool) -> None:
-        self.__init_code_hosting_client(spec, branch_used_for_tracking_data=head)
+    def retarget_pull_request(self, spec: CodeHostingSpec, head: LocalBranchShortName,
+                              opt_ignore_if_missing: bool, opt_update_related_descriptions: bool) -> None:
+        if self.__code_hosting_client is None:
+            self.__init_code_hosting_client(spec, branch_used_for_tracking_data=head)
 
-        pr: Optional[PullRequest] = self.__get_sole_pull_request_for_head(head, ignore_if_missing=ignore_if_missing)
+        pr: Optional[PullRequest] = self.__get_sole_pull_request_for_head(
+            head, ignore_if_missing=opt_ignore_if_missing)
         if pr is None:
             return
 
@@ -2520,10 +2521,11 @@ class MacheteClient:
                 'Consider modifying the branch layout file (`git machete edit`)'
                 f' so that {bold(head)} is a child of {bold(pr.base)}.')
 
+        pr_with_original_base = pr.copy()
         if pr.base != new_base:
             self.code_hosting_client.set_base_of_pull_request(pr.number, base=new_base)
             print(f'{spec.base_branch_name.capitalize()} branch of {pr.display_text()} has been switched to {bold(new_base)}')
-            pr = pr._replace(base=new_base)
+            pr.base = new_base
         else:
             print(f'{spec.base_branch_name.capitalize()} branch of {pr.display_text()} is already {bold(new_base)}')
 
@@ -2540,6 +2542,19 @@ class MacheteClient:
             self.__annotations[head] = Annotation(self.__pull_request_annotation(spec, pr, current_user))
         self.save_branch_layout_file()
 
+        if opt_update_related_descriptions:
+            print(f"Updating descriptions of other {spec.pr_short_name}s...")
+            applicable_prs: List[PullRequest] = self.__get_applicable_pull_requests(related_to=pr_with_original_base) \
+                + self.__get_applicable_pull_requests(related_to=pr)
+            applicable_prs = [pr_ for pr_ in applicable_prs if pr_.number != pr.number]
+
+            for pr in applicable_prs:
+                new_description = self.__get_updated_pull_request_description(pr)
+                if (pr.description or '').rstrip() != new_description.rstrip():
+                    self.code_hosting_client.set_description_of_pull_request(pr.number, description=new_description)
+                    pr.description = new_description
+                    print(fmt(f'Description of {pr.display_text()} (<b>{pr.head} {get_right_arrow()} {pr.base}</b>) has been updated'))
+
     def __derive_code_hosting_domain(self, spec: CodeHostingSpec) -> str:
         return self.__git.get_config_attr_or_none(key=spec.git_config_keys.domain) or spec.default_domain
 
@@ -2635,6 +2650,8 @@ class MacheteClient:
     def __init_code_hosting_client(self, spec: CodeHostingSpec,
                                    branch_used_for_tracking_data: Optional[LocalBranchShortName] = None
                                    ) -> Tuple[str, OrganizationAndRepositoryAndRemote]:
+        if self.__code_hosting_client is not None:
+            raise UnexpectedMacheteException("Code hosting client has already been initialized.")
         domain = self.__derive_code_hosting_domain(spec)
         org_repo_remote = self.__derive_org_repo_and_remote(
             spec, domain=domain, branch_used_for_tracking_data=branch_used_for_tracking_data)
@@ -2749,7 +2766,7 @@ class MacheteClient:
     ) -> None:
         # first make sure that head branch is synced with remote
         try:
-            self.__sync_before_creating_pr(spec, opt_onto=opt_onto, opt_yes=opt_yes)
+            self.__sync_before_creating_pull_request(spec, opt_onto=opt_onto, opt_yes=opt_yes)
         except InteractionStopped:
             return
 
@@ -3015,7 +3032,8 @@ class MacheteClient:
         elif ans in ('q', 'quit'):
             raise InteractionStopped
 
-    def __sync_before_creating_pr(self, spec: CodeHostingSpec, *, opt_onto: Optional[LocalBranchShortName], opt_yes: bool) -> None:
+    def __sync_before_creating_pull_request(self, spec: CodeHostingSpec, *,
+                                            opt_onto: Optional[LocalBranchShortName], opt_yes: bool) -> None:
 
         self.expect_at_least_one_managed_branch()
         self.__empty_line_status = True
diff --git a/git_machete/code_hosting.py b/git_machete/code_hosting.py
index 7d2e6ad..120ad82 100644
--- a/git_machete/code_hosting.py
+++ b/git_machete/code_hosting.py
@@ -7,16 +7,75 @@ from git_machete.git_operations import GitContext, LocalBranchShortName
 from git_machete.utils import bold
 
 
-class PullRequest(NamedTuple):
-    number: int
-    display_prefix: str
-    user: str
-    base: str
-    head: str
-    head_repo_id: int
-    state: str
-    description: Optional[str]
-    html_url: str
+class PullRequest:
+    def __init__(self, number: int, display_prefix: str, user: str, base: str, head: str, head_repo_id: int,
+                 state: str, description: Optional[str], html_url: str):
+        self.__number = number
+        self.__display_prefix = display_prefix
+        self.__user = user
+        self.__base = base
+        self.__head = head
+        self.__head_repo_id = head_repo_id
+        self.__state = state
+        self.__description = description
+        self.__html_url = html_url
+
+    def copy(self) -> "PullRequest":
+        return PullRequest(
+            number=self.__number,
+            display_prefix=self.__display_prefix,
+            user=self.__user,
+            base=self.__base,
+            head=self.__head,
+            head_repo_id=self.__head_repo_id,
+            state=self.__state,
+            description=self.__description,
+            html_url=self.__html_url
+        )
+
+    @property
+    def number(self) -> int:
+        return self.__number
+
+    @property
+    def display_prefix(self) -> str:
+        return self.__display_prefix
+
+    @property
+    def user(self) -> str:
+        return self.__user
+
+    @property
+    def base(self) -> str:
+        return self.__base
+
+    @base.setter
+    def base(self, base: str) -> None:
+        self.__base = base
+
+    @property
+    def head(self) -> str:
+        return self.__head
+
+    @property
+    def head_repo_id(self) -> int:
+        return self.__head_repo_id
+
+    @property
+    def state(self) -> str:
+        return self.__state
+
+    @property
+    def description(self) -> Optional[str]:
+        return self.__description
+
+    @description.setter
+    def description(self, description: str) -> None:
+        self.__description = description
+
+    @property
+    def html_url(self) -> str:
+        return self.__html_url
 
     def short_display_text(self, fmt: bool = True) -> str:
         return self.display_text(fmt).split(" ")[1]
diff --git a/git_machete/generated_docs.py b/git_machete/generated_docs.py
index fbbd66f..8ae69fe 100644
--- a/git_machete/generated_docs.py
+++ b/git_machete/generated_docs.py
@@ -670,7 +670,7 @@ long_docs: Dict[str, str] = {
                  <b>--yes</b>
               Do not ask for confirmation whether to push the branch.
 
-           `restack-pr`:
+           `restack-pr [-U|--update-related-descriptions]`:
  
               Perform the following sequence of actions:
 
@@ -685,7 +685,14 @@ long_docs: Dict[str, str] = {
               The drafting/undrafting is useful in case the GitHub repository has set up CODEOWNERS.
               Draft PRs don't get code owners automatically added as reviewers.
 
-           `retarget-pr [-b|--branch=<branch>] [--ignore-if-missing]`:
+              <b>Options:</b>
+
+                 <b>-U</b>, <b>--update-related-descriptions</b>
+
+              Update the generated sections ("intros") of PR descriptions that list the upstream and/or downstream PRs.
+              See help for `git machete github update-pr-descriptions --related` for details.
+
+           `retarget-pr [-b|--branch=<branch>] [--ignore-if-missing] [-U|--update-related-descriptions]`:
  
               Sets the base of the current (or specified) branch's PR to upstream (parent) branch, as seen by git machete (see `git machete show up`).
 
@@ -704,6 +711,11 @@ long_docs: Dict[str, str] = {
 
               Ignore errors and quietly terminate execution if there is no PR opened for current (or specified) branch.
 
+                 <b>-U</b>, <b>--update-related-descriptions</b>
+
+              Update the generated sections ("intros") of PR descriptions that list the upstream and/or downstream PRs.
+              See help for `git machete github update-pr-descriptions --related` for details.
+
            `sync`:
  
               <b>Deprecated.</b> Use `github checkout-prs --mine`, `delete-unmanaged` and `slide-out --removed-from-remote`.
@@ -785,7 +797,7 @@ long_docs: Dict[str, str] = {
         <b>Usage:</b><b>
            git machete gitlab <subcommand></b>
 
-        where `<subcommand>` is one of: `anno-mrs`, `checkout-mrs`, `create-mr`, `retarget-mr` or `restack-mr`.
+        where `<subcommand>` is one of: `anno-mrs`, `checkout-mrs`, `create-mr`, `retarget-mr`, `restack-mr` or `update-mr-descriptions`.
 
         Creates, checks out and manages GitLab MRs while keeping them reflected in branch layout file.
 
@@ -886,7 +898,7 @@ long_docs: Dict[str, str] = {
                  <b>--yes</b>
               Do not ask for confirmation whether to push the branch.
 
-           `restack-mr`:
+           `restack-mr [-U|--update-related-descriptions]`:
  
               Perform the following sequence of actions:
 
@@ -901,7 +913,14 @@ long_docs: Dict[str, str] = {
               The drafting/undrafting is useful in case the GitLab project has set up code owners.
               Draft MRs don't get code owners automatically added as reviewers.
 
-           `retarget-mr [-b|--branch=<branch>] [--ignore-if-missing]`:
+              <b>Options:</b>
+
+                 <b>-U</b>, <b>--update-related-descriptions</b>
+
+              Update the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs.
+              See help for `git machete gitlab update-mr-descriptions --related` for details.
+
+           `retarget-mr [-b|--branch=<branch>] [--ignore-if-missing] [-U|--update-related-descriptions]`:
  
               Sets the target of the current (or specified) branch's MR to upstream (parent) branch, as seen by git machete (see `git machete show up`).
 
@@ -920,6 +939,11 @@ long_docs: Dict[str, str] = {
 
               Ignore errors and quietly terminate execution if there is no MR opened for current (or specified) branch.
 
+                 <b>-U</b>, <b>--update-related-descriptions</b>
+
+              Update the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs.
+              See help for `git machete gitlab update-mr-descriptions --related` for details.
+
            `update-mr-descriptions`:
  
               Updates the generated sections ("intros") of MR descriptions that list the upstream and/or downstream MRs


Test patch:
diff --git a/tests/completion_e2e/test_completion_e2e.py b/tests/completion_e2e/test_completion_e2e.py
index e9e0655..9ba472f 100644
--- a/tests/completion_e2e/test_completion_e2e.py
+++ b/tests/completion_e2e/test_completion_e2e.py
@@ -66,8 +66,10 @@ test_cases: Dict[str, str] = {
         "--all --by --debug -h --help --mine -v --verbose",
     "git machete github create-pr -":
         "-U --debug --draft -h --help --title --update-related-descriptions -v --verbose --yes",
+    "git machete github restack-pr -":
+        "-U --debug -h --help --update-related-descriptions -v --verbose",
     "git machete github retarget-pr --":
-        "--branch --debug --help --ignore-if-missing --verbose",
+        "--branch --debug --help --ignore-if-missing --update-related-descriptions --verbose",
     "git machete github retarget-pr -b ":
         "develop master",
     "git machete github update-pr-descriptions -":
@@ -80,8 +82,10 @@ test_cases: Dict[str, str] = {
         "--all --by --debug -h --help --mine -v --verbose",
     "git machete gitlab create-mr -":
         "-U --debug --draft -h --help --title --update-related-descriptions -v --verbose --yes",
+    "git machete gitlab restack-mr -":
+        "-U --debug -h --help --update-related-descriptions -v --verbose",
     "git machete gitlab retarget-mr --":
-        "--branch --debug --help --ignore-if-missing --verbose",
+        "--branch --debug --help --ignore-if-missing --update-related-descriptions --verbose",
     "git machete gitlab retarget-mr -b ":
         "develop master",
     "git machete gitlab update-mr-descriptions -":
diff --git a/tests/test_github.py b/tests/test_github.py
index 793f5f1..8ee3776 100644
--- a/tests/test_github.py
+++ b/tests/test_github.py
@@ -357,4 +357,4 @@ class TestGitHub(BaseTest):
         assert_failure(["github", "update-pr-descriptions", "--all", "--related"],
                        "update-pr-descriptions subcommand must take exactly one of the following options: --all, --mine, --related")
         assert_failure(["github", "update-pr-descriptions", "--update-related-descriptions"],
-                       "--update-related-descriptions option is only valid with create-pr subcommand.")
+                       "--update-related-descriptions option is only valid with create-pr, restack-pr and retarget-pr subcommands.")
diff --git a/tests/test_github_checkout_prs.py b/tests/test_github_checkout_prs.py
index 113063b..8783aac 100644
--- a/tests/test_github_checkout_prs.py
+++ b/tests/test_github_checkout_prs.py
@@ -523,7 +523,7 @@ class TestGitHubCheckoutPRs(BaseTest):
             ["github", "checkout-prs", "--mine"],
             """
             Checking for open GitHub PRs... OK
-            Warn: Current user github_user has no open pull request in repository example-org/example-repo
+            Warn: User github_user has no open pull request in repository example-org/example-repo
             """
         )
 
diff --git a/tests/test_github_retarget_pr.py b/tests/test_github_retarget_pr.py
index 6b87a36..50ebb99 100644
--- a/tests/test_github_retarget_pr.py
+++ b/tests/test_github_retarget_pr.py
@@ -421,13 +421,32 @@ class TestGitHubRetargetPR(BaseTest):
 
         self.repo_sandbox.check_out('feature')
         self.repo_sandbox.remove_remote('origin_2')
-        self.repo_sandbox.set_git_config_key("machete.github.prDescriptionIntroStyle", "full")
 
         assert_success(
-            ['github', 'retarget-pr'],
-            'Base branch of PR #15 has been switched to branch-1\n'
-            'Checking for open GitHub PRs... OK\n'
-            'Description of PR #15 has been updated\n'
+            ['github', 'retarget-pr', '-U'],
+            """
+            Base branch of PR #15 has been switched to branch-1
+            Updating descriptions of other PRs...
+            Checking for open GitHub PRs... OK
+            Description of PR #20 (feature_1 -> feature) has been updated
+            Description of PR #25 (feature_2 -> feature) has been updated
+            Description of PR #35 (feature_4 -> feature) has been updated
+            """
+        )
+        pr15 = github_api_state.get_pull_by_number(15)
+        assert pr15 is not None
+        assert pr15['base']['ref'] == 'branch-1'
+        assert pr15['body'] == '# Summary'
+
+        self.repo_sandbox.set_git_config_key("machete.github.prDescriptionIntroStyle", "full")
+        assert_success(
+            ['github', 'retarget-pr', '-U'],
+            """
+            Base branch of PR #15 is already branch-1
+            Checking for open GitHub PRs... OK
+            Description of PR #15 has been updated
+            Updating descriptions of other PRs...
+            """
         )
         pr15 = github_api_state.get_pull_by_number(15)
         assert pr15 is not None
diff --git a/tests/test_github_update_pr_descriptions.py b/tests/test_github_update_pr_descriptions.py
index 1ef959a..487b179 100644
--- a/tests/test_github_update_pr_descriptions.py
+++ b/tests/test_github_update_pr_descriptions.py
@@ -216,6 +216,6 @@ class TestGitHubUpdatePRDescriptions(BaseTest):
             ["github", "update-pr-descriptions", "--mine"],
             """
             Checking for open GitHub PRs... OK
-            Warn: Current user github_user has no open pull request in repository example-org/example-repo
+            Warn: User github_user has no open pull request in repository example-org/example-repo
             """
         )
diff --git a/tests/test_gitlab.py b/tests/test_gitlab.py
index 9dee2e4..233bbf1 100644
--- a/tests/test_gitlab.py
+++ b/tests/test_gitlab.py
@@ -307,4 +307,4 @@ class TestGitLab(BaseTest):
         assert_failure(["gitlab", "update-mr-descriptions", "--all", "--related"],
                        "update-mr-descriptions subcommand must take exactly one of the following options: --all, --mine, --related")
         assert_failure(["gitlab", "update-mr-descriptions", "--update-related-descriptions"],
-                       "--update-related-descriptions option is only valid with create-mr subcommand.")
+                       "--update-related-descriptions option is only valid with create-mr, restack-mr and retarget-mr subcommands.")
diff --git a/tests/test_gitlab_checkout_mrs.py b/tests/test_gitlab_checkout_mrs.py
index a9c35e1..cfbac8f 100644
--- a/tests/test_gitlab_checkout_mrs.py
+++ b/tests/test_gitlab_checkout_mrs.py
@@ -524,7 +524,7 @@ class TestGitLabCheckoutMRs(BaseTest):
             ["gitlab", "checkout-mrs", "--mine"],
             """
             Checking for open GitLab MRs... OK
-            Warn: Current user gitlab_user has no open merge request in project example-org/example-repo
+            Warn: User gitlab_user has no open merge request in project example-org/example-repo
             """
         )
 
diff --git a/tests/test_gitlab_retarget_mr.py b/tests/test_gitlab_retarget_mr.py
index 22f8800..1ff4205 100644
--- a/tests/test_gitlab_retarget_mr.py
+++ b/tests/test_gitlab_retarget_mr.py
@@ -438,6 +438,59 @@ class TestGitLabRetargetMR(BaseTest):
         assert mr30['target_branch'] == 'root'
         assert mr30['description'] == '# Summary'
 
+        self.repo_sandbox.check_out('feature')
+        self.repo_sandbox.remove_remote('origin_2')
+
+        assert_success(
+            ['gitlab', 'retarget-mr', '-U'],
+            """
+            Target branch of MR !15 has been switched to branch-1
+            Updating descriptions of other MRs...
+            Checking for open GitLab MRs... OK
+            Description of MR !20 (feature_1 -> feature) has been updated
+            Description of MR !25 (feature_2 -> feature) has been updated
+            Description of MR !35 (feature_4 -> feature) has been updated
+            """
+        )
+        mr15 = gitlab_api_state.get_mr_by_number(15)
+        assert mr15 is not None
+        assert mr15['target_branch'] == 'branch-1'
+        assert mr15['description'] == '# Summary'
+
+        self.repo_sandbox.set_git_config_key("machete.gitlab.mrDescriptionIntroStyle", "full")
+        assert_success(
+            ['gitlab', 'retarget-mr', '-U'],
+            """
+            Target branch of MR !15 is already branch-1
+            Checking for open GitLab MRs... OK
+            Description of MR !15 has been updated
+            Updating descriptions of other MRs...
+            """
+        )
+        mr15 = gitlab_api_state.get_mr_by_number(15)
+        assert mr15 is not None
+        assert mr15['target_branch'] == 'branch-1'
+        assert mr15['description'] == textwrap.dedent('''
+            <!-- start git-machete generated -->
+
+            ## Tree of downstream MRs as of 2023-12-31
+
+            * **MR !15 (THIS ONE)**:
+              `branch-1` ← `feature`
+
+                * MR !20:
+                  `feature` ← `feature_1`
+
+                * MR !25:
+                  `feature` ← `feature_2`
+
+                * MR !35:
+                  `feature` ← `feature_4`
+
+            <!-- end git-machete generated -->
+
+            # Summary''')[1:]
+
     @staticmethod
     def gitlab_api_state_for_test_retarget_mr_root_branch() -> MockGitLabAPIState:
         return MockGitLabAPIState.with_mrs(
diff --git a/tests/test_gitlab_update_mr_descriptions.py b/tests/test_gitlab_update_mr_descriptions.py
index a74cd3d..9f2e3a3 100644
--- a/tests/test_gitlab_update_mr_descriptions.py
+++ b/tests/test_gitlab_update_mr_descriptions.py
@@ -215,6 +215,6 @@ class TestGitLabUpdateMRDescriptions(BaseTest):
             ["gitlab", "update-mr-descriptions", "--mine"],
             """
             Checking for open GitLab MRs... OK
-            Warn: Current user gitlab_user has no open merge request in project example-org/example-repo
+            Warn: User gitlab_user has no open merge request in project example-org/example-repo
             """
         )