Skip to content

Keep feature branches updated and checked out

What does this Merge Request do and why?

This MR needs !2190 (merged) merged first.

This MR offers the ability to keep your WIP feature branches for the various GDK projects (gitlab, gitaly, etc) updated with the respective upstream default branch when running gdk update

Using gitlab/ as an example:

$ cd <GDK_ROOT>
$ cd gitlab/
$ git co -b testing-gdk-2176 origin/master
$ date=$(date "+%s") ; echo ${date} > ${date}.txt ; git add . ; git commit -S -m "${date}"
$ echo "" >> README.md

$ git diff origin/master
diff --git a/1632809311.txt b/1632809311.txt
new file mode 100644
index 00000000000..18a5860fb1e
--- /dev/null
+++ b/1632809311.txt
@@ -0,0 +1 @@
+1632809311
diff --git a/README.md b/README.md
index ee7eef9aa2d..6dc03c79f49 100644
--- a/README.md
+++ b/README.md
@@ -122,3 +122,4 @@ ## Is it any good?
 ## Is it awesome?

 [These people](https://twitter.com/gitlab/likes) seem to like it.
+

$ git status
On branch testing-gdk-2176
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")

Now enable the gdk.auto_rebase_projects setting:

$ gdk config set gdk.auto_rebase_projects true

And then a gdk update:

$ cd <GDK_ROOT>
$ gdk update
--snip--

--------------------------------------------------------------------------------
Updating gitlab-org/gitlab
--------------------------------------------------------------------------------
✅️ Successfully fetched and rebased 'master' on 'testing-gdk-2176' for 'gitlab/'

--snip--

--------------------------------------------------------------------------------
Updating gitlab-org/gitlab-shell to v13.21.1
--------------------------------------------------------------------------------
✅️ Successfully fetched and checked out 'v13.21.1' for 'gitlab-shell/'

--snip--

--------------------------------------------------------------------------------
Updating gitlab-org/gitaly to a47a975ef7d4ef51e0d68c5662d5cb3bb5b83b76
--------------------------------------------------------------------------------
✅️ Successfully fetched and checked out 'a47a975ef7d4ef51e0d68c5662d5cb3bb5b83b76' for 'gitaly/'

$ cd gitlab/

$ git diff origin/master
diff --git a/1632809311.txt b/1632809311.txt
new file mode 100644
index 00000000000..18a5860fb1e
--- /dev/null
+++ b/1632809311.txt
@@ -0,0 +1 @@
+1632809311
diff --git a/README.md b/README.md
index ee7eef9aa2d..6dc03c79f49 100644
--- a/README.md
+++ b/README.md
@@ -122,3 +122,4 @@ ## Is it any good?
 ## Is it awesome?

 [These people](https://twitter.com/gitlab/likes) seem to like it.
+

$ git status
On branch testing-gdk-2176
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")

At this point, the testing-gdk-2176 branch has had its diff stashed, origin/master has been rebased and then the stash popped 😀

Merge Request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Ash McKenzie

Merge request reports