0
0
Gitdevops~20 mins

Feature branch workflow in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Feature Branch Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of creating and switching to a feature branch
What is the output of the following commands when run in a Git repository?

git branch feature-login
git checkout feature-login
Git
git branch feature-login
git checkout feature-login
Aerror: branch 'feature-login' already exists
BSwitched to branch 'feature-login'
Cfatal: not a git repository (or any of the parent directories): .git
DOn branch master
Attempts:
2 left
💡 Hint
The second command switches your working directory to the new branch.
🔀 Workflow
intermediate
2:00remaining
Correct sequence to integrate a feature branch
Which option shows the correct sequence of commands to update your feature branch with the latest changes from the main branch before merging?
Agit checkout main → git pull → git checkout feature → git merge main
Bgit checkout main → git merge feature → git pull
Cgit checkout feature → git merge main → git pull
Dgit checkout feature → git pull → git checkout main → git merge feature
Attempts:
2 left
💡 Hint
You need to update main first, then merge main into your feature branch.
Troubleshoot
advanced
2:00remaining
Resolving a merge conflict in a feature branch
You tried to merge the main branch into your feature branch and got a conflict. What is the correct next step to resolve the conflict?
Git
git checkout feature
git merge main
ADelete the feature branch and recreate it from main
BRun 'git reset --hard' to discard all changes and try merging again
CRun 'git push' immediately to update the remote branch
DEdit the conflicting files to fix conflicts, then run 'git add' on those files and 'git commit' to complete the merge
Attempts:
2 left
💡 Hint
Conflicts must be fixed manually before committing.
Best Practice
advanced
2:00remaining
Best practice for naming feature branches
Which naming style is considered best practice for feature branches in Git?
Afeature/login-page
BLoginPageFeature
Cfeature_login_page
Dloginpagefeature
Attempts:
2 left
💡 Hint
Use lowercase letters and hyphens for readability.
🧠 Conceptual
expert
2:00remaining
Why use feature branches in Git workflows?
What is the main advantage of using feature branches in a Git workflow?
AThey merge all changes directly into the main branch without testing
BThey prevent any code review before merging
CThey isolate development of new features, allowing parallel work without affecting the main codebase
DThey automatically deploy code to production when merged
Attempts:
2 left
💡 Hint
Think about how teams work on different features at the same time.