awaescher / RepoZ

👨‍💻 A zero-conf git repository hub for Windows and macOS with Windows Explorer- & CLI-enhancements
MIT License
1.01k stars 91 forks source link

Remotes #140

Closed CClouseau closed 3 years ago

awaescher commented 3 years ago

Why is this closed, @CClouseau? Love this!

CClouseau commented 3 years ago

Why is this closed, @CClouseau? Love this!

Hi @awaescher, First of all, I'd like to tell you that, since a colleague showed it to me, Repoz as been a fantastic time saver... ... and I spent that time improving it to save more time :). I did this first locally on the downloaded Zip sources and finally decided to create a fork for safekeeping my work and be able to merge new stuff from mother branch (I think that's the purpose of GIT). I use an internal GIT daily, but we do not use pull requests. I thought, I created a pull request just to commit my devs on my fork...

Anyway, if you think that the new feature is polished enough, I'd be glad to share it !

awaescher commented 3 years ago

I'm very happy to hear that you like RepoZ and even more that you're willing to invest your own time to improve it. Honestly, this means a lot to me.

I'll have a look at the pull request in detail soon, as I fear that getting remote branches could take some time and I don't want to do that everytime a repository is "read" from disk but only when the list of remote branches is really required. As said, I did not have a look in that detail - maybe you got that already implemented the way I'd love to have it (first idea would be to read the remote banches in a deferred way as soon as the context menu for the git branches gets shown. This is how I scan for *.sln files to be opened in Visual Studio, for example).

--

Update:

I thought, I created a pull request just to commit my devs on my fork...

You can use pull requests within your repository to merge branches internally as well (like merging a feature branch into the main branch). What you did was a pull request from your fork to the original repository - this is not required if you just want to maintain your own fork of a repository. However I'm glad that you did that, otherwise I would not have been notified about this feature.

CClouseau commented 3 years ago

Hi Andreas, I have the same concern as you about getting remote branches (it takes about 2-3 secs per repository), so I implemented a "Fetch all" command to trigger this manually. Your idea of deferring the "fetch all" is good because if the user really wants to rely on this feature, it has to be automated.

About the "a" filter: it selects repositories that have at least one branch matching the expression (not necessarily checked out). By now, the only way to find out which branch actually matched the pattern is to open the checkout list.

By the way, the whole thing started with the need to know which repository was changed for the current version of the project I work on, whether I checked out the impacted branches or not. We have a branch naming convention ([VersionNumber]/Foo) so the "a" filter helps me to have an overview on which services have to be packaged for further delivery (no, it’s not automated ^^).

As the remote branches were displayed in the checkout list I HAD to implement their checkout action (with my poor knowledge about GIT this wasn’t done in a minute).

Anyway, the code may need to be resharpened a bit and you'll find out I didn't implement it on grr or Mac + I strip remote branches name of "origin/" but this prefix may differ so it may not be hard coded.

awaescher commented 3 years ago

I changed the behavior a bit: Each fetch operation does now fetch "--all" to update the remote branches. Always. And if you want to automatically remove the stale local branches, you can set an option "Prune on fetch". However, there's no UI for that yet. So you'll have to add this manually in the appsettings file:

Example:

{"AutoFetchMode":1, "PruneOnFetch":true }
awaescher commented 3 years ago

Thank you once again for helping me out 🥳

CClouseau commented 3 years ago

Hi @awaescher , I thank you in return for your interest on this feature and I'm more than pleased to share it !

I forgot to remove the Fetch All call I added for testing purpose: you did it. As a side effect, it broke the pull command and maybe more :( I'll check your implementation of the prune option

There's more coming up from my repoZ fork ! I implemented Open with GIT Bash and doing this, refactored the exe path initialisation (the branch is GitBash, I'll create a pull request soon).

awaescher commented 3 years ago

Nevermind, git pull is working just fine ☺️

awaescher commented 3 years ago

... However, there's no UI for that yet ...

Will be there soon:

image