Sharing a feature branch without merging means pushing your branch to the shared remote repository so a teammate can fetch and check it out directly, while main stays completely untouched.
Key Points: • git push origin <branch-name> uploads your branch and its commits to the remote without touching main. • The other developer runs git fetch to pull down the new branch reference, then git checkout <branch-name> to switch to it. • No merge commit is created and the main branch history is unaffected. • This is useful for pair-review, testing someone else's work-in-progress, or handing off a task mid-development. • A draft pull request is a common alternative that gives the same visibility plus a discussion thread.
Example: You push git push origin feature/login-form, then tell your teammate the branch name; they run git fetch origin and git checkout feature/login-form to get the exact same files you have, including any WIP commits.
Code Example:
git push origin feature/login-form
# teammate's machine
git fetch origin
git checkout feature/login-formInterview Tip: A concise interview answer is:
"I push the feature branch to the remote with git push origin branch-name, and the other developer fetches and checks it out locally. Nothing touches main, so we can share and review work-in-progress code without any merge happening."