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

Display the current Git branch in the Terminal prompt (PS1) #3284

Closed
jankeromnes opened this issue Feb 26, 2021 · 4 comments · Fixed by gitpod-io/workspace-images#447
Closed
Assignees
Labels
feature: terminal meta: never-stale This issue can never become stale type: feature request New feature or request type: improvement Improves an existing feature or existing code

Comments

@jankeromnes
Copy link
Contributor

Today, the Git branch/context is not shown in Gitpod's Terminal prompt.

But maybe it could be nice to have it included (this seems to be a common pattern, and Git even comes standard with the dedicated helper __git_ps1).

Current prompt

Screenshot 2021-02-26 at 14 33 39

Proposed new prompt

Screenshot 2021-02-26 at 14 36 05

This can be achieved like so:

PS1='\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)") $ '

Criticism

I believe we've previously decided against having this, because the current branch name is already displayed in the bottom left of the IDE:

Screenshot 2021-02-26 at 14 36 20

However, I personally find it hard to spot, and sometimes still accidentally push to the wrong place because I don't know I'm on the wrong branch.

@ghuntley ghuntley self-assigned this Feb 26, 2021
@stale
Copy link

stale bot commented May 28, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label May 28, 2021
@stale stale bot closed this as completed Jun 7, 2021
@jankeromnes
Copy link
Contributor Author

Not stale! Still extremely relevant, especially when working with submodules(!)

@jankeromnes jankeromnes reopened this Jun 7, 2021
@stale stale bot removed meta: stale This issue/PR is stale and will be closed soon labels Jun 7, 2021
@jankeromnes jankeromnes added meta: never-stale This issue can never become stale good-first-issue type: improvement Improves an existing feature or existing code labels Jun 7, 2021
@Shulammite-Aso
Copy link
Contributor

@jankeromnes can I take this up? I searched for good-first-issues and saw a few, but this one has stayed the longest, hence I'd like to start from it.

@jankeromnes
Copy link
Contributor Author

Hi @Shulammite-Aso! Sure, many thanks for offering! I'll assign this issue to you for now (to let others know that you're intending to work on this).

Please let me know if you have any questions. 😊 FYI, you'll probably want to implement the fix in this file: https://github.com/gitpod-io/workspace-images/blob/master/base/Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: terminal meta: never-stale This issue can never become stale type: feature request New feature or request type: improvement Improves an existing feature or existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants