Skip to main content
Senior

Git Push Arguments

Senior

Task

HEAD is currently on the foo branch. Without switching away from it, push the local main branch to the branch of the same name on origin.

Requirements

  • Explicitly specify the remote origin and the local branch main.
  • Do not publish the foo branch.
  • Do not switch HEAD to main.

Expected result

The remote main and o/main must move to the local main commit, and HEAD must stay on foo.

What you will learn

After completing this task you will be able to:

  • push a branch that is not the current one;
  • explicitly specify the source for push;
  • separate the position of HEAD from the reference being published.
Goal
localC0C1C2main o/mainC3HEAD foo
originC0C1C2HEAD main
Git trainer0 commands
terminal
localC0C1o/mainC2mainC3HEAD foo
originC0C1HEAD main