Any Git shortcuts for the current branch and the branch it tracks?

I would like to do something like this:

$ git fetch origin
$ git rebase -i origin/a_very_very_very_long_branch_name

Where, my local branch name is as same as a_very_very_very_long_branch_name.

  • Install package with pip from specific branch of github
  • In Git, how do you see and manage commits that aren't in a branch?
  • How can I start a clean branch with no ancestry, then commit files progressively?
  • How does git handle commits in a merge?
  • creating git branch after the fact?
  • Tag multiple branches in git?
  • So when I execute this kind of command, I don’t want to copy and paste the long branch name again and again.

    Are there any shortcuts for the current branch name in Git?

  • Correspondece between Git client and server versions
  • Subversion reverting resolved file
  • How to get the current checked out Git branch name through pygit2?
  • How to restore shelved changes in Intellij when the shelf tab is not shown?
  • How can I specify which branch should be checked out in a fresh clone?
  • How can I tell if one commit is an ancestor of another commit (or vice-versa)?
  • 3 Solutions collect form web for “Any Git shortcuts for the current branch and the branch it tracks?”

    In your particular example, if your branch is tracking the remote branch, you can just do

    git fetch
    git rebase -i
    

    Without parameters.

    In case your branch is not tracking the remote branch, that can be set up by doing

    git branch -u origin/a_very_very_very_long_branch_name
    

    If your branch is set up to track the remote branch of the same name in origin, you can use @{u} as pointed out in the manpage gitrevisions:

    <branchname>@{upstream}, e.g. master@{upstream}, @{u}

    The suffix @{upstream} to a branchname (short form <branchname>@{u}) refers to the branch that the branch specified by branchname is set to build on top of. A missing branchname defaults to the current one.

    You could always create an alias to do the rebase to origin/current-branch;

    git fetch ; git rebase -i origin/$(git rev-parse --abbrev-ref HEAD)

    Or, if you don’t specifically need the interactive part of the rebase;

    git pull --rebase

    Git Baby is a git and github fan, let's start git clone.