DevOps Interview Handbook
DevOps Interview Handbook
Specifying the branch name is useful when you are working on multiple branches
locally or need to interact with a branch different from the one you are currently
on.
What is <upstream>?
In Git, the term upstream refers to the remote branch that the local branch is
currently tracking.
Having multiple remotes in a Git repository means that your local repository is
configured to interact with more than one remote repository.
git revert: Creates a new commit that reverses the changes made by a specific
commit, preserving the original commit history.
git reset: Moves the current branch's HEAD backward to a specific commit,
potentially modifying or discarding recent commits.
Let’s say there was a branch named dev from which two branches were created
named featA and featB
As we can see, dev, featA, and featB shared a common commit history until
commit c. After that, all three branches were developed separately. So, we can
say all three branches diverged from each other after commit c.
What is git merge?
git merge incorporates changes from the named commits (since the time their
histories diverged from the current branch) into the current branch.
It will replay the changes made on the featB branch since it diverged from dev
(i.e., D) until its current commit (J ) on top of dev, and record the result in a new
commit along with the names of the parent commits and a log message from the
user describing the changes.
Common branching strategy
main: Latest stable production codebase
dev: Main branch for active development. Other development branches merge
here.