bill-auger / git-branch-status

A shell script that prints out pretty git branch sync status reports
GNU General Public License v3.0
237 stars 34 forks source link

fetch all #9

Closed CrispyDrone closed 4 years ago

CrispyDrone commented 5 years ago

Hello,

Is there a reason why this script doesn't do a fetch all? Are there use cases where you would not want to do a fetch all while using this script?

I've only used it as such git fetch --all && git-branch-status .

Thanks

bill-auger commented 5 years ago

that has been suggested before; and i can see how that may be a small convenience in some use-cases - i think it is best not to fetch by default though, because querying remotes is slow when there are several remotes, even if there are no updates - also, the results are not likely to change from one run to the next - its usually something that you would only need to do once at the beginning of the work day

when you have many remotes, the output can be quite long; so it is often easier to grok when the script is run multiple times with different args to get different views of the state of things - ive always assumed it would be annoying to have it querying remotes every time you run it

maybe fetch --all could be added so that it happens only when the --all or --verbose args are passed - or maybe a new configuration constant could be added so that the fetch only happens if the script has not been run since some user-configurable duration - i suppose that could be set to '0' to always fetch, and '-1' to never fetch - what do people think?

CrispyDrone commented 5 years ago

Thanks for your reply. I hadn't thought about the situation of having multiple remotes since I have no experience with it yet.

I now agree that a fetch --all on each run could easily be overkill.

A command line flag such as --all, or the configuration variable both sound as good ideas. I like the configuration variable especially since you can have it be local to a repository by making use of git config?

Some of the repositories I need to work with are much more active and if multiple people are working on it concurrently it can be critical to have the latest state so you avoid any branch diverging. At least this has been my experience in a team that is not very communicative unfortunately.

Perhaps instead of forcing a fetch --all it could be useful to have the standard behavior be at least a fetch? As far as I'm aware the script is currently not doing this since I've been caught red handed 2 times in the past week by forgetting to do a fetch before starting a new feature branch from develop.

Just giving my thoughts of course. I'm mainly curious about the way other people are utilizing the script in their workflows so I can improve mine :)

bill-auger commented 5 years ago

the development branch has an initial implementation of this feature - i may change the implementation though - perhaps environment vars would be better than a config file

bill-auger commented 4 years ago

i re-worked this feature so that it is configurable with either config file or with environment variables - the file:: 'gbs-config.sh.inc.example' explains it

the master branch is up-to-date with the development branch now