What does the argument @{u} mean in Git?
Asked Answered
P

1

65

In the book "Git: Version Control for Everyone. Beginner's Guide" on page 69 there is a suggestion: "As an alternative to git pull, we can also use git fetch followed by git merge @{u}".

What does @{u} mean here?

A search in Google for git merge @{u} provides a link to this page https://mislav.net/2013/02/merge-vs-rebase/ where @{u} can also be found.

Perren answered 20/10, 2013 at 6:31 Comment(0)
G
79

It is a shortcut to refer to the upstream branch which the current branch is tracking. So for instance if you're on branch topic/fix_blub which is tracking origin/topic/fix_blub then git merge @{u} does the same thing as git merge origin/topic/fix_blub.

@{u} is part of Git's mini-language for locating revisions, which is described in detail here.

Giveandtake answered 20/10, 2013 at 6:54 Comment(4)
how do I print the value of @{u}?Surrealism
@PhilipRego git rev-parse @{u}Fincher
when i try to use git reset --hard @{u} the console doesn't execute the command but starts a new line with >> at the start (as if i had an open string going) I'm Using git on Windows in powershell and i noticed a few times that i need to use different control characters than other people (e.g. ~ instead of ^) is this the same case here? do you know anything about that?Eraste
@StefanLippeck see this answer for how to escape it in PowerShell.Expulsion

© 2022 - 2024 — McMap. All rights reserved.