Developing Applications Using Cisco Core Platforms and APIs (DEVCOR) — Question 347
A developer checks out a branch named feat23 from a Git repository. The developer receives this error after attempting to switch to a branch named feat89:
Error: You have local changes to 'feat23'; not switching branches.
Which command switches to branch feat89?
Answer options
- A. git checkout -r feat89
- B. git mv feat89
- C. git checkout -m feat89
- D. git merge feat89
Correct answer: C
Explanation
The correct command is 'git checkout -m feat89' because the '-m' option allows the developer to switch branches while preserving local changes. The other options are incorrect as 'git checkout -r' is not a valid command, 'git mv' is used for moving files, and 'git merge' is for merging branches, not switching.