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

Feature request: Push/Pop-GitBranch commands #859

Closed
DJackman123 opened this issue Apr 22, 2021 · 4 comments
Closed

Feature request: Push/Pop-GitBranch commands #859

DJackman123 opened this issue Apr 22, 2021 · 4 comments

Comments

@DJackman123
Copy link

I'd really love to be able to keep a stack of recent branches I've switched to, similar to how the Push/Pop-Location cmdlets work. This is something I could easily write myself, but I would also want these new functions to have tab completion on the branch names. That's something posh-git is already doing for git commands. But if I'm writing my own function in my profile, posh-git isn't providing anything for me to use to provide the same tab completion functionality, so I would have to copy code in order to implement it.

So here is my first question: does it make sense to add a Push-GitBranch and Pop-GitBranch command to posh-git, or does that go against the grain of what posh-git is trying to provide?
And if it doesn't make sense to add these commands in posh-git, what about the idea of exposing some of the posh-git functionality as functions that my own functions can call to avoid having to duplicate code?

@rkeithhill
Copy link
Collaborator

posh-git has avoided providing PowerShell like cmdlets on top of Git. There are modules that do that e.g. https://www.powershellgallery.com/packages/PSGit/2.1.0 However, it would make sense for posh-git to provide tab-completion service for other commands. There's already some talk of this in issue #852.

@dahlbyk
Copy link
Owner

dahlbyk commented Apr 26, 2021

This seems to overlap quite a bit with #641, which I've been meaning to revisit. Actually tracking a branch stack may be handy in some situations, but it seems primary use case is probably adequately covered by tab-completing recent branches first?

Also, in case you're not aware: git checkout - is a shorthand for git checkout @{-1}, which you can use to switch to your most recent other branch.

@DJackman123
Copy link
Author

Actually, I was not aware of the git checkout @{-1} syntax. That is pretty close to what I was looking for. Thanks for letting me know! Looks like the idea of opening up the tab completion for other commands is already being tracked, so I'm closing this issue.

@dahlbyk
Copy link
Owner

dahlbyk commented Apr 26, 2021

Thanks for the suggestion!

For your and anyone else's reference, git help revisions documents a whole bunch of useful syntax for referring to various points in time.

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

No branches or pull requests

3 participants