What happens to the commit history when you perform a git merge of a feature branch into the main branch?
Think about whether the original commits from the feature branch remain visible after merging.
A git merge creates a new commit called a merge commit that combines changes from both branches. It preserves the original commit history of both branches, showing where they diverged and merged.
What is the main effect on commit history when you perform a git rebase of a feature branch onto the main branch?
Consider how the commit timestamps and order change after rebasing.
git rebase moves the feature branch commits to the tip of the main branch, rewriting their history to create a straight, linear sequence of commits without merge commits.
You run git merge feature into your main branch. There are conflicting changes in a file. What will git output?
git merge featureThink about what git says when it cannot automatically merge files.
When git encounters conflicts during a merge, it stops and shows conflict messages. It asks you to fix conflicts manually before committing.
You and your team are working on a shared feature branch. Which practice is safer to avoid rewriting history and confusing others?
Consider what happens when you rewrite history on a branch others use.
Rebasing rewrites commit history, which can confuse teammates if done on shared branches. Merging preserves history and is safer for collaboration.
You rebased your feature branch but accidentally dropped some commits. How can you find and restore those lost commits?
Think about how git tracks all recent changes, even if they seem lost.
git reflog records all recent HEAD movements, including rebases. You can find lost commits there and recover them by cherry-picking or resetting.