Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I'm not exactly sure what you want with the whole of rd, but …programmatically get the name of the remote branch which my local branch is tracking… sounds very much like the @{upstream}/@{u} ...
Answer
#2: Post edited
- I'm not exactly sure what you want with the whole of `rd`, but
- > …programmatically get the name of the remote branch which my local branch is tracking…
sounds very much like [the `@{upstream}`/`@{u}` shortcut][1]. You can provide a branch before it to refer to the tracked remote of that branch, or leave it bare to refer to the tracked remote of the branch you current have checked out.- [1]: https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltbranchnamegtupstreamemegemmasterupstreamememuem
- I'm not exactly sure what you want with the whole of `rd`, but
- > …programmatically get the name of the remote branch which my local branch is tracking…
- sounds very much like [the `@{upstream}`/`@{u}` shortcut][1]. You can provide a branch before it to refer to the tracked remote of that branch, or leave it bare to refer to the tracked remote of the branch you currently have checked out.
- If `remote1` is actually the tracking remote for `master`, you could even write the alias as
- ```ini
- [alias]
- rd = range-diff master..@{u} master@{u}..HEAD
- ```
- [1]: https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltbranchnamegtupstreamemegemmasterupstreamememuem
#1: Initial revision
I'm not exactly sure what you want with the whole of `rd`, but > …programmatically get the name of the remote branch which my local branch is tracking… sounds very much like [the `@{upstream}`/`@{u}` shortcut][1]. You can provide a branch before it to refer to the tracked remote of that branch, or leave it bare to refer to the tracked remote of the branch you current have checked out. [1]: https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltbranchnamegtupstreamemegemmasterupstreamememuem