Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user/repo before branch (based on remote.origin.url) #403

Closed
wants to merge 2 commits into from

Conversation

stas00
Copy link
Contributor

@stas00 stas00 commented Oct 19, 2018

This is an excellent tool! Thank you, Martin.

I work in parallel with the original repo and its fork on github, and therefore often it's hard to tell which of the two I'm inside off, especially since both have a 'master'. So I found it very helpful to also display the user/repo information together with the branch.

This PR adds user/repo to [branch] giving us [user/repo:branch]

It supports 3 url types: git config --get remote.origin.url

I'm sure that it needs to be made configurable and perhaps custom color support added, but this is a start.

Thank you!

…mote.origin.url

supports 3 url types:
- https://user@bitbucket.org/user/repo.git
- https://github.com/user/repo.git
- git@github.com:user/repo.git
adds user/repo to [branch] giving us [user/repo:branch]
@magicmonty
Copy link
Owner

Thanks, very nice idea. But you are right, this option should be at least configurable (and off by default), as this would change the current prompts of many users ;) Also an update of the docs would be nice.

@stas00
Copy link
Contributor Author

stas00 commented Oct 23, 2018

Just to check that I understand you correctly, you're in favor of adding this feature, just asking to make it configurable, off by default and updating the docs, correct? (so I won't be wasting time if it's not going to be accepted - I'm fine with it being hardcoded in the version I use ;)

@magicmonty
Copy link
Owner

Jepp, thats correct. Once you have this in, I will accept this gladly ;)

- USERNAME_REPO token is now configurable via GIT_PROMPT_PREFIX="[${Blue}_USERNAME_REPO_|"
- added a new basic theme demonstrating it Single_line_username_repo
@stas00
Copy link
Contributor Author

stas00 commented Oct 24, 2018

OK, @magicmonty, please have a look. I thought that the best place to optionally push it is in GIT_PROMPT_PREFIX, for example:

GIT_PROMPT_PREFIX="[${Blue}_USERNAME_REPO_|"

I added themes/Single_line_username_repo.bgptheme demonstrating it.

Let me know if you're happy with it and then I will finalize this PR with docs.

Also let me know whether the token name is intuitive, what it gives is username/reponame string, perhaps USERNAME_REPONAME instead?

Here is the current prompt I have with this forked repo:

(pytorch-3.7) ~/github/00git/bash-git-prompt [stas00/bash-git-prompt|master]>

@stas00
Copy link
Contributor Author

stas00 commented Nov 9, 2018

@magicmonty, you asked me to make it configurable - which I did 2 weeks ago - can we complete this please?

@magicmonty
Copy link
Owner

@stas00 I'm sorry but I'm currently a bit busy. I will check this on the weekend. I promise ;)

@magicmonty
Copy link
Owner

magicmonty commented Nov 10, 2018

@stas00 Sorry, I f**cked the merge of the PR up.
The changes are incorporated into the master but I made some changes:

  1. I placed the functionality into the gitstatus.sh, where it belongs and made it opt in, because of performance reasons
  2. I optimized the theme so that if there is no remote, the separator will not be shown
  3. I added a README entry

I close this PR but don't worry, as I said, the changes are in the master branch now (my bad).

@magicmonty magicmonty closed this Nov 10, 2018
@stas00
Copy link
Contributor Author

stas00 commented Nov 10, 2018

Looks perfect, @magicmonty. Thank you for integrating it in the most efficient way and completing the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants