drewdeponte / git-ps-rs

Official git-ps Rust implementation - the future of git-ps
https://git-ps.sh
MIT License
78 stars 8 forks source link

Add support to `gps list` to handle being run when not in a branch with an upstream tracking branch #276

Open drewdeponte opened 9 months ago

drewdeponte commented 9 months ago

Currently when you run gps list in a branch that has no upstream tracking branch it errors with the following.

✔ gps ls

Error: get upstream branch name failed

Instead of doing this it would be nice if it did something more useful. I am not sure just yet exactly what that is.

I was thinking it might make sense to simply display all the commits in the branch along with a warning saying there is no upstream tracking branch and letting the user know it isn't officially a patch stack yet.

This would for example be useful in the scenario where you start a new git repository and you just have a main branch locally with no upstream tracking branch because you haven't created an upstream repository yet and set it up in your repo.

One downside to this idea would be that if you are in an existing project that has a bunch of commits on a mainline and you are on another branch without an upstream tracking branch, but it is based on the mainline then it would be displaying all the commits back to the beginning of time. Which seems not super useful.

Anyways, just wanted to start this discussion around this to see if there is something more useful we could/should be doing.

Alizter commented 9 months ago

We could also suggest the git command that needs to be run in order to add an upstream since that is not always easy to remember.

drewdeponte commented 9 months ago

Yeah, that might be the most useful thing to do actually.