In Git, what is the main reason remotes enable collaboration among developers?
Think about how developers share their work using Git.
Remotes act as shared repositories where developers push their changes and pull updates from others, enabling collaboration.
After adding a remote named 'origin' pointing to a GitHub repository, what does the command git remote -v output?
git remote -vThis command lists all remotes with their URLs and access types.
git remote -v shows the remote names and their URLs for fetch and push operations.
You want to get the latest changes from the remote repository and update your local branch. Which sequence of commands is correct?
You first switch to the branch, then fetch and merge changes.
Switching to the branch before fetching and merging ensures you update the correct branch. Option A shows this sequence.
You try to push your changes with git push origin main but get this error:
! [rejected] main -> main (non-fast-forward)
What is the most likely cause?
Think about what 'non-fast-forward' means in Git.
This error means the remote has commits your local branch lacks. You must pull and merge before pushing.
In a team using Git, which practice best helps avoid conflicts and keeps the remote repository healthy?
Think about how to keep your local work up to date with others.
Pulling regularly keeps your local copy updated and reduces merge conflicts before pushing changes.