Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git bash auto update feature in windows #2187

Closed
kantiprasanna opened this issue May 11, 2019 · 25 comments
Closed

git bash auto update feature in windows #2187

kantiprasanna opened this issue May 11, 2019 · 25 comments

Comments

@kantiprasanna
Copy link

If we have auto update feature in git bash then we can move safely

@dscho
Copy link
Member

dscho commented May 13, 2019

I have no idea what you mean. Could you please clarify?

@kantiprasanna
Copy link
Author

SImilar to vscode if we have git auto update feature for git bash then it would be nice

@PhilipOakley
Copy link

If I remember correctly, there is one already embedded, but I can't remember if that was for the SDK or the regular Git-for-Windows. Look in the Build-Extra repo.

Because full releases don't occur that often, you won't see the note very often. (see the Git Calendar)

@dscho
Copy link
Member

dscho commented Aug 11, 2019

There is a feature you can activate in the first page of the installer whereby Git for Windows will check for updates daily, and offer a notification when a new version is available (where you simply have to click a button to start the update).

We do not have a feature to auto-update in a fully automated way.

If this is desired, then once again, this is a perfect opportunity for a contributor to start enhancing Git for Windows. @kantiprasanna this is open source, have a look at how the current daily check is implemented. That should get you started.

@sladyn98
Copy link

@dscho So if we want git for windows to update on its own would we have to run https://github.com/git-for-windows/build-extra/blob/ef78e61c865379ce2c07ec3b7fc01c6c930a054d/installer/install.iss#L2300
On its own instead of prompting the user for a button click ?

@dscho
Copy link
Member

dscho commented Apr 29, 2020

if we want git for windows to update on its own would we have to run https://github.com/git-for-windows/build-extra/blob/ef78e61c865379ce2c07ec3b7fc01c6c930a054d/installer/install.iss#L2300
On its own instead of prompting the user for a button click ?

That file refers to the definition that is compiled into the official Git for Windows installer. I don't think that's what you meant.

What I think you will want to run is git update-git-for-windows -y, but do note that this will most likely cause problems if this runs behind the users' backs while they are using Git.

@sladyn98
Copy link

sladyn98 commented Apr 29, 2020

What I think you will want to run is git update-git-for-windows -y, but do note that this will most likely cause problems if this runs behind the users' backs while they are using Git.

@dscho Yeah this is what I meant, so in order to solve this we would need to achieve the following am I right:
a) Detect an update and run git update-git-for-windows -y
b) Do this while the user is not using git

@dscho
Copy link
Member

dscho commented Apr 29, 2020

a) Detect an update and run git update-git-for-windows -y

git update-git-for-windows -y will detect an update of itself. No need for extra code.

b) Do this while the user is not using git

Yes. That'll be a lot trickier.

@sladyn98
Copy link

@dscho I am not very familiar with the git for windows codebase but would a possible solution involve maybe warning the user that git is being updated ?

@dscho
Copy link
Member

dscho commented Apr 30, 2020

That has nothing to do with Git's source code base. Your guess how to warn the user is as good as mine. Actually, yours is better than mine because you clearly thought about this more than I have.

@sladyn98
Copy link

Yeah I was guessing that possibly we could do two things, that when a new update is detected check whether the git has an active running terminal if yes do not update, and when the user starts using it again we display that hey there is a new version available and we are updating it to the new version kindly wait. But it would still be difficult for users who keep the terminal running "forever"

@dscho
Copy link
Member

dscho commented Apr 30, 2020

Right. At some stage, fully automatic updates without warning the users will become impossible.

@sladyn98
Copy link

Maybe we could try and implement a sort of proof of concept in a pull request and then see if it works.
So before diving into the code, any tips on where I could begin ?

@dscho
Copy link
Member

dscho commented Apr 30, 2020

A shell script using ps that excludes the current process could determine whether Git is in use.

@sladyn98
Copy link

yeah , and where would this script be called from in git ?

@dscho
Copy link
Member

dscho commented Apr 30, 2020

@sladyn98 I imagine you'd want a daily check? So you would piggy-back on top of the code that was introduced in git-for-windows/build-extra#155 and git-for-windows/build-extra@e4badda...d984925

@carehart
Copy link

carehart commented Jun 4, 2020

I have a couple of follow-on questions on this issue, but folks can let me know if they think they should be in separate ones than this:

First, is there any way to enable that auto-update (offered in the installer) if somehow we miss it? I just found that my gfw was over a year old. Of course, the git gui offers nothing to help. It was only when I thought to do a git --version and compare to the latest on the site that I realize it was out of date.

Along the same lines, and with regard to doing a manual command line update, I had hoped just typing git at the command line would tell me if there was an argument to allow me to update things, but it did not. I had to search around to find the update-git-for-windows argument.

Perhaps the problem is that the output of the git command alone is designed to show "standard git output". If so, is there really no way folks could be told how to do a manual update by the gfw git command itself?

@dscho
Copy link
Member

dscho commented Jun 5, 2020

First, is there any way to enable that auto-update (offered in the installer) if somehow we miss it? I just found that my gfw was over a year old. Of course, the git gui offers nothing to help. It was only when I thought to do a git --version and compare to the latest on the site that I realize it was out of date.

You can always run git update-git-for-windows manually. The automatic check can only be installed by re-running the installer and checking the checkbox.

Along the same lines, and with regard to doing a manual command line update, I had hoped just typing git at the command line would tell me if there was an argument to allow me to update things, but it did not. I had to search around to find the update-git-for-windows argument.

That's not really possible because git update-git-for-windows is not available in core Git (which produces that output of running git without arguments).

In fact, that command is not even available in Portable Git. Only when Git for Windows was installed via the installer is that command available.

Such optional commands will never be described by the output of git.

@carehart
Copy link

carehart commented Jun 5, 2020

Fair enough. You're the maintainer, so there's our answer. :-)

I'll just add that I simply wondered if it MIGHT be possible that you compiled something from core Git (which caused the output of that git command), and that you might therefore be able to ADD that special argument to the help output. You don't leave open that possibility, so either you cannot or will not (along with any means to change the auto-update setting without reinstall).

So be it. At least now it's clear to any who may have wondered.

Thanks for the response and confirmation of things, and of course for the efforts by you and others on the project as it is.

@dscho
Copy link
Member

dscho commented Jun 5, 2020

If you can find a way to make this work without affecting Portable Git in confusing ways, please let us know. I'm more than open to accepting PRs that solve this problem properly.

BTW that goes for any Git for Windows issue: my opinion is just that: my opinion. I will be delighted to be proven wrong whenever it helps improve Git for Windows.

@PhilipOakley
Copy link

@carehart also try git help -a which does attempt to pull in some of the external commands, and also lists your aliases.

You could create yourself a 'short cut' alias to help get you there quicker.

@carehart
Copy link

carehart commented Jun 5, 2020

If you can find a way to make this work without affecting Portable Git in confusing ways, please let us know. I'm more than open to accepting PRs that solve this problem properly.

BTW that goes for any Git for Windows issue: my opinion is just that: my opinion. I will be delighted to be proven wrong whenever it helps improve Git for Windows.

@dscho Thanks for carrying on the conversation. To be clear, I'm only a user of GfW (indeed, only a very occasional one). I don't myself understand the connection with Portable Git, though I see you said in the first reply that it doesn't support this argument for updating. So I gather the code for the help is shared by both, and that would the reason for not being able/not wanting to make a change that would affect both.

As for being "more open to a PR", FWIW I will note that before I even asked here, I did search the code (here in github for this project) for the phrase at the top help, "These are common Git commands", and I found no reference to it. That's why I assumed it was not something we could implement, and thus my question. :-)

I do see now that the git gui source is here. I don't know tcl myself, but would you (or anyone) know if it would be possible for someone to add an update menu option to the gui help? That would be a natural place for most GfW users to look, I'd think. What I mean is can such a menu option in tcl even cause execution of a command line to run that update arg above? If so, perhaps even someone with no tcl experience could try to hack an implementation.

Just trying to help someone readily figure out how to do a GfW update, whether from the GUI or the command line. :-)

@carehart
Copy link

carehart commented Jun 5, 2020

@carehart also try git help -a which does attempt to pull in some of the external commands, and also lists your aliases.

You could create yourself a 'short cut' alias to help get you there quicker.

Thanks, @PhilipOakley. FWIW I tried that variation of git help. To be clear, it makes no mention of this special update argument.

Indeed, it immediately shows the output in less (even on Windows, and even though Windows does not provide a less command). So I gather that this is again the "core Git" help that Johannes was referring to in his first reply.

You also propose I could create an alias. Again, the point of my request was that someone running GfW has no obvious way to update it, if they don't know that special argument. (And of course, I mean if they somehow they did not choose the "auto-update" feature at installation, that Johannes mentions. I wouldn't have turned it off, if offered, but I suppose it's possible I installed GfW before it was offered as an option in the installer.)

More specifically, I was saying that if someone in that situation did what was natural for them, they would not readily find a way to update GfW. Some would go to the GfW UI, but it has no update feature (like in the Help menu). And others would go to command line and type git help, but again it offered no update option. It was only in googling that I found this special argument.

I simply was asking on behalf of all users, in the hope of helping them get or keep it updated, in this scenario. If somehow the situation I am proposing seems incredibly unique for someone to end up in, I will understand it a low priority problem to resolve. It just struck me as an easy one, since I ended up in that boat. :-)

@PhilipOakley
Copy link

I tried that variation of git help.

True. you need the -a option AND either an additional script, exe or alias for it to show in the list, unfortunately

they don't know that special argument.

True again. Discoverability is tricky for many features in git

I simply was asking on behalf of all users, in the hope of helping them get or keep it updated, in this scenario.

Noted. I'd mentioned the sneak paths that contributors could try so as to get a quick win. As always getting folks to help contribute is tricky because of the wide range of background knowledge / skills / perseverance that are often needed to bridge the two domains (Windows and Linux).

Contributions are always welcome.

@dscho
Copy link
Member

dscho commented Oct 15, 2021

Closing this stale ticket.

@dscho dscho closed this as completed Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants