XK0-005 · Question #704
A Linux systems administrator needs to add additional code to code that resides within a repository without changing the original code. Once completed, the additional code will be merged into the…
The correct answer is B. git rebase. To integrate new changes into a main branch from a feature branch while maintaining a clean, linear history, git rebase is a common first step before merging.
Question
A Linux systems administrator needs to add additional code to code that resides within a repository without changing the original code. Once completed, the additional code will be merged into the main branch. Which of the following commands should the administrator use first?
Options
- Agit push
- Bgit rebase
- Cgit tag
- Dgit clone
How the community answered
(37 responses)- A11% (4)
- B73% (27)
- C14% (5)
- D3% (1)
Why each option
To integrate new changes into a main branch from a feature branch while maintaining a clean, linear history, `git rebase` is a common first step before merging.
`git push` is used to upload local repository changes to a remote repository, not to integrate code between local branches or prepare for a merge into a main branch.
`git rebase` is used to integrate changes from one branch into another by moving or combining a sequence of commits to a new base commit, effectively rewriting commit history. This is often done to incorporate upstream changes into a feature branch before merging, allowing the "additional code" to be added on top of the latest "original code" without creating a merge commit, resulting in a cleaner, linear history when later merged into the main branch.
`git tag` is used to mark specific points in the project's history as important, typically for releases, and does not facilitate adding or merging code.
`git clone` is used to create a copy of an existing Git repository, which is typically the very first step when starting to work on a project, not for adding code to an already existing local repository.
Concept tested: Git workflow - rebase before merge
Source: https://git-scm.com/docs/git-rebase
Topics
Community Discussion
No community discussion yet for this question.