Skip to content

Replace --show-current in track-origin-same-branch-name to support older versions of Git #4

@salcode

Description

@salcode

The git branch --show-current command was only introduced in Git 2.22.0, which was released 2019-06-07.

If you’re running an older version of Git, this command will fail. Instead we can use

git rev-parse --abbrev-ref HEAD

which gives the same result as git branch --show-current but is supported in much older versions of GIt.

Change to Make

We want to change git branch --show-current in this line

track-origin-same-branch-name = !git branch --set-upstream-to=origin/$(git branch --show-current)

and this line

Alias for `git branch --set-upstream-to=origin/$(git branch --show-current)`.

to git rev-parse --abbrev-ref HEAD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions