Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Live branch is synchronized with remote target branch to allow for pushing without force #1209

Closed
Henning-Schulz opened this issue Sep 14, 2021 · 2 comments · Fixed by #1210
Assignees

Comments

@Henning-Schulz
Copy link
Member

Use Case

I want to use the Git config staging as a backup for a development config server. It should use the same repository and branch for pulling and pushing. I then want to merge the state of this branch into another one using a pull request. This second branch serves as source for further config server stages, e.g., prod.
The config servers are deployed in Kubernetes, i.e., may frequently restart and/or be removed and re-created.

Problem

The development config server fetches changes from the source branch into workspace, then merges these changes into live, which is then pushed to the source branch. This can destroy a clean commit history, disallowing for rebase.

Suggested Solution

When fetching from the source branch, always rebase live on the source branch and then merge the changes into workspace. This will retain the commit history and add changes only on top.

Side Note

The remote repo will still contain commits from workspace, like "Commit configuration file and agent mapping changes". These are required, as the config server needs to know which workspace changes have been merged into which commit on the live branch.

@Henning-Schulz Henning-Schulz self-assigned this Sep 14, 2021
@Henning-Schulz Henning-Schulz changed the title Live branch should be rebased on remote source branch Live branch should be rebased on source branch when pulling from remote repo Sep 14, 2021
@Henning-Schulz
Copy link
Member Author

When merging via pull request, you need to make sure to use the Merge pull request button. Otherwise, the two branches won't have a common commit history anymore, which prevents further merges. A drawback is that many internal commits to workspace stay visible (see below for an example) but currently there is no way to work around it.

*   4ed113d (origin/master) Merge pull request #3 from Henning-Schulz/develop
|\
| *   a853ab0 (origin/develop) change live mode duration
| |\
| | * 8bf4090 Commit configuration file and agent mapping changes
* | |   fdcb680 Merge pull request #2 from Henning-Schulz/develop
|\ \ \
| |/ /
| * |   f0ba626 change polling interval
| |\ \
| | * | b555ba8 Commit configuration file and agent mapping changes
| | |/
| | * 283e550 Commit configuration file and agent mapping changes
| | *   b312bb5 Initial configuration synchronization
| | |\
| | |/
| |/|
| * |   7348982 enable agent commands
| |\ \
|/ / /
| * | 83ded91 Commit configuration file and agent mapping changes
| * | be9bb61 Commit configuration file and agent mapping changes
| * | 885e534 Initializing Git repository
|  /
* | 77727a0 (HEAD -> develop, master) Initial commit
 /
* 1411ea1 Initializing Git repository

@Henning-Schulz
Copy link
Member Author

After several discussions, we came to the end that we actually need a slightly different behavior: to make sure that we can push to the target repo without force, live and target branches should be synchronized (i.e., live should be reset to target) on startup. Merging from source needs to be the same as before, to allow for diverging source and target repos. I will adjust the issue title accordingly.

@Henning-Schulz Henning-Schulz changed the title Live branch should be rebased on source branch when pulling from remote repo Live branch is synchronized with remote target branch to allow for pushing without force Oct 1, 2021
mariusoe pushed a commit that referenced this issue Nov 11, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
1 participant