Day 32: Rebase Replays Your Commits, and a Restore Inherits Everything You Don't Override
Today's two tasks are both about a new base. A feature branch that needs to sit on top of a master that has moved. A database instance that needs to come back from a snapshot taken when things were fine. In each case, the interesting question is the same: what carries over, and what do you have to say out loud? One Git task, one AWS task. Rebase a feature branch onto master without creating a…
Two tasks were focused on a new base. A feature branch needed to sit on top of a master branch that had changed. Additionally, a database instance had to be restored from a snapshot taken when things were working properly. In both instances, the common question was what carried over and what needed to be explicitly stated.
The first task was to rebase a feature branch onto the master branch without creating a merge commit, then snapshot and restore an RDS instance. The rebase task involved bringing a developer's feature branch up to date with the master branch, preserving the feature work without any merge commit.
To do this, the developer navigated to the repository directory, listed the branches and their log, checked out the feature branch, and then executed the git rebase master command. This replayed each commit on the feature branch on top of the current master, assigning each commit a new hash since the parent changed. The result was a straight line of commits, but without a history record of what actually happened.
The rebase operation required discipline in direction and execution. Rebasing onto the master branch applied the feature branch changes while preserving the original feature work. The push required using git push --force-with-lease, as a normal push was refused due to the rewritten history. However, this protection could be defeated if background processes like git fetch ran during the rebase.
The conflict experience during rebase was different from merging, with more stops and each commit conflict needing individual resolution.
The second task was restoring an RDS instance from a snapshot, requiring care in specifying certain configuration settings that would otherwise be automatically inherited. The restore command aws rds restore-db-instance-from-db-snapshot was straightforward, but it cloned the source configuration including the engine, version, storage type and other settings.
Only specific parameters like instance class, subnet group, availability zone, public accessibility, and auto-minor-version-upgrade could be overridden during the restore.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.