0
0
Gitdevops~5 mins

Tracking branches concept in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a tracking branch in Git?
A tracking branch is a local branch that is linked to a remote branch. It helps you keep your local branch updated with changes from the remote branch.
Click to reveal answer
beginner
How do you create a local branch that tracks a remote branch?
You can create a tracking branch using: git checkout -b local_branch_name origin/remote_branch_name or simply git checkout remote_branch_name if it exists remotely.
Click to reveal answer
intermediate
What command shows the tracking branches and their status?
Use git branch -vv to see local branches, their tracking branches, and if they are ahead or behind.
Click to reveal answer
beginner
Why are tracking branches useful in teamwork?
Tracking branches help you easily fetch and merge changes from teammates by linking your local work to the remote branch they update.
Click to reveal answer
intermediate
How do you change the upstream branch a local branch tracks?
Use git branch --set-upstream-to=origin/branch_name to change the remote branch your local branch tracks.
Click to reveal answer
What does a tracking branch in Git do?
ALinks a local branch to a remote branch to track changes
BDeletes a remote branch automatically
CCreates a backup of your repository
DMerges two unrelated branches
Which command shows local branches with their tracking info?
Agit branch -vv
Bgit status
Cgit fetch
Dgit merge
How do you set a local branch to track a remote branch?
Agit clone branch_name
Bgit push origin branch_name
Cgit branch --set-upstream-to=origin/branch_name
Dgit init
What happens when you run git checkout remote_branch_name if the branch exists remotely but not locally?
APushes local changes to remote
BDeletes the remote branch
CShows an error
DCreates a local tracking branch for the remote branch
Why is it helpful to have tracking branches in a team project?
AThey prevent anyone from pushing changes
BThey simplify syncing your work with teammates' changes
CThey automatically resolve conflicts
DThey delete old branches
Explain what a tracking branch is and how it helps in managing code with a remote repository.
Think about how your local work stays updated with others' work.
You got /3 concepts.
    Describe the steps and commands to create a local branch that tracks a remote branch and how to check its status.
    Focus on commands that connect and show tracking info.
    You got /3 concepts.