StreakyCobra / gws

Colorful KISS helper for git workspaces
https://streakycobra.github.io/gws/
MIT License
235 stars 22 forks source link

Match branches with their remote in the config #21

Open victornoel opened 9 years ago

victornoel commented 9 years ago

Hi,

I have a repository with many branches and each of them points to a different remote. But I don't know why, gws tries to match them to origin… for example I get one with a message as follow: andreptb : No remote branch origin/andreptb

But in my git config I have: [branch "andreptb"] remote = andreptb merge = refs/heads/master

with andreptb declared as a remote.

StreakyCobra commented 9 years ago

Hi,

At the beginning gws was using only two remotes names: origin and upstream, this was hard-coded inside the script. An issue (#12) was opened about this, and now it's possible to define per-repository custom remotes names inside the .projects.gws file. These informations are only used to allow gws to set remotes when recreating the workspace on a new place/machine/etc.

gws is still looking at origin for displaying the status because... I haven't thought about this special case :smile:

What seems possible is:

What seems difficult/impossible without big changes:

So if there is a way to get the configured remote for a given branch, I can use this information when checking for branches statuses. But you will still have to re-associate branches with their remotes when you recreate the workspace somewhere.

victornoel commented 9 years ago

I understand better where this comes from: easily setting up local clones.

I think that at least, it would make sense to use the configured remote for each branch to check their status, I don't see why anybody would be expecting something else. That's your first point, and in a way, the original subject of my request.

As for the second point, I didn't even think about it ^^ So yes, I guess you can't do so much… well, I'm not sure it is something extremely needed (to have gws autocreating local branches and associating them to remotes) since after cloning, you usually create branches yourself when the need arises, and then you would associate them to remotes by hand too, it would make sense to do so.

StreakyCobra commented 9 years ago

I think that at least, it would make sense to use the configured remote for each branch to check their status, I don't see why anybody would be expecting something else.

Agreed, I'll investigate on this (when I'll have time :sweat: )

I'm not sure it is something extremely needed (to have gws autocreating local branches and associating them to remotes) since after cloning, you usually create branches yourself when the need arises, and then you would associate them to remotes by hand too, it would make sense to do so.

I share your point of view. It is be possible to do it, but it would make everything (code, syntaxes, etc.) more complex. gws aims to stay simple :)