git-ps-rs icon indicating copy to clipboard operation
git-ps-rs copied to clipboard

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

Open drewdeponte opened this issue 1 year ago • 2 comments

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.

drewdeponte avatar Nov 20 '23 21:11 drewdeponte

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.

Alizter avatar Nov 20 '23 21:11 Alizter

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

drewdeponte avatar Nov 20 '23 21:11 drewdeponte