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
Periodic/automatic repo fetches #25
Comments
Might I suggest making this configurable as well. Some workflows may not favor this approach. |
Or maybe add back the dedicated button for fetch next to pull like SourceTree that let user to make sure they can fetch properly. |
Sounds like a great idea |
Given that SM automatically refreshes the repository, it would make sense to have that be a less common or well known keyboard shortcut ( |
Fine with me but I think it would be a bit unfair for people who got used to using |
Agreed, however:
|
Same here. Previously using github desktop, SM is amazing but I miss this automatic feature or at least a button in top bar to know I'm behind before trying to push. |
Is there any news on this ? I work on multiple computers and forget times and times again to fetch / pull, it's really annoying. I was using Tower before and that is the feature that I miss the most now. |
Since SM refreshes instantly when you do something in the CLI, you can run a simple bash script for fetching every now and then. It's by far not as pretty as a setting in SM would be, but it does the job. while :; do echo "$(date +'%H:%M') | fetching '$(basename $(pwd))'..."; git fetch; sleep 60; done |
I would very much appreciate a periodic fetch. I sometimes forget to fetch when I start working on something. Most commonly I would only need to fetch the current branch, not all. |
As I was reading about the issue, I just realized something. The proper fix to this problem would be NOT a periodic check by a client (which is what we are doing manually anyway). The real solution would be to extend core git protocol. Instead of short polling for updates, git server should adopt a command like IMAP IDLE to be able to communicate real-time notifications. I did a preliminary research in google / duckduckgo, but to my surprise it doesn't seem like any work is being done in that direction. There was, however, one thread of discussion found at Git Mailing List Archive: "IMAP IDLE"-like long-polling "git fetch". |
Interestingly, Gerrit (code review tool & infrastructure) has been having this feature for ages: gerrit stream-events. For example, one can monitor which patches and reviews are published to The Qt Project: $ ssh codereview.qt-project.org gerrit stream-events
{"submitter":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"refUpdate":{"oldRev":"0000000000000000000000000000000000000000","newRev":"d0a1f5fbd8be58ca73947e3de279599de03345ee","refName":"refs/changes/25/317825/1","project":"qt/qtdeclarative"},"type":"ref-updated","eventCreatedOn":1602858068}
{"submitter":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"refUpdate":{"oldRev":"0000000000000000000000000000000000000000","newRev":"e1629f2bd714feff8ad041fc7fb5e99f94f2f77a","refName":"refs/changes/25/317825/meta","project":"qt/qtdeclarative"},"type":"ref-updated","eventCreatedOn":1602858068}
{"uploader":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"patchSet":{"number":1,"revision":"d0a1f5fbd8be58ca73947e3de279599de03345ee","parents":["6b20e0e08ed48982e849dbbf9fc53113a491f5e4"],"ref":"refs/changes/25/317825/1","uploader":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"createdOn":1602858068,"author":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"kind":"REWORK","sizeInsertions":72,"sizeDeletions":-72},"change":{"project":"qt/qtdeclarative","branch":"dev","id":"Ie5bba408000211b24694aa0143bdf79c4a298f42","number":317825,"subject":"CMake: Regenerate examples to use qt_add_executable","owner":{"name":"Alexandru Croitor","email":"...","username":"alexandru.croitor"},"url":"https://codereview.qt-project.org/c/qt/qtdeclarative/+/317825","commitMessage":"CMake: Regenerate examples to use qt_add_executable\n\nTask-number: QTBUG-87661\nChange-Id: Ie5bba408000211b24694aa0143bdf79c4a298f42\n","createdOn":1602858068,"status":"NEW"},"project":"qt/qtdeclarative","refName":"refs/heads/dev","changeKey":{"id":"Ie5bba408000211b24694aa0143bdf79c4a298f42"},"type":"patchset-created","eventCreatedOn":1602858068}
{"submitter":{"name":"Qt Sanity Bot","email":"qt_sanitybot@qt-project.org","username":"qt_sanity_bot"},"refUpdate":{"oldRev":"e1629f2bd714feff8ad041fc7fb5e99f94f2f77a","newRev":"c95dae1b459281b967f0dd78173cda8a982ffc5b","refName":"refs/changes/25/317825/meta","project":"qt/qtdeclarative"},"type":"ref-updated","eventCreatedOn":1602858069}
... |
That is a neat idea, however I do not think that is related to this specific issue. Extending the git protocol should be taken up with git itself? |
Indeed, that's what I wrote. It would require changes to the git protocol, and then waiting for major git servers' providers to upgrade, before widely adopting it in clients. For the time being, spamming |
+1 GitKraken has this feature of background refresh and displaying a notification in the top bar when the remote became ahead by some commit, avoiding wasted time with local commit and push conflict. |
I would like to add that Visual Studio Code also has this feature. |
Surprisingly, no one here ever talked about how fundamentally incompatible periodic fetches are with force-pushes. There is an option But automatic background refreshes would actually defeat even that safety mechanism — unless you know better how to pass those optional I encourage everyone in this thread to take a look at the official git documentation, concerns which it raises and workarounds it offers. I'm not here to teach you how to work, but generally when multiple people work on a single feature, it's better to merge commits from their personal branches every so often (possibly in a form of pull requests), instead of concurrently pushing to a shared branch. Your workflow may vary though. Personally, I'd prefer having some sort of opt-in "push notifications" (with multiple levels of irony) from git servers. |
Hey @ratijas. I don't quite understand your viewpoint here. This issue is about the client periodically running
This is not something Sublime Merge will be able to do unless it is a feature in git, correct?
I cannot argue with that, and completely agree. This issue however, is more geared towards when I myself work on my own projects on one machine, and later forget to do a pull on my other machine. Not only that, when collaborating, if I merge my feature branch into the main branch, but forget to do a pull first, the merge commits will look ugly and be mostly annoying. I would suggest the moderation team mark our back and fourths as off-topic, since I do not feel they provide anything to the issue. |
@ratijas we are talking mostly about an app notification, not related to the git commands, repo or workflow -- which are left untouched and up to the user preference. Just like you can visit the repo webpage and check the last commit timestamp; Again, this would be purely an app action, not any git change to the local repo. |
Is it possible to at least auto-fetch on application start? |
@4ekki, not on startup, but I did write a way to get manual fetch all to work: https://forum.sublimetext.com/t/manual-fetch-all-command/57556 |
So I can see why someone might not want an auto-fetch feature. Fetching technically changes the commits accessible within a repo, so e.g., in a(n uncommon) corner-case where your local repo has a reference to a recently deleted upstream branch, fetching will remove that commit. An alternative could be this: currently the There are definitely some details to figure out re: how it checks for fetchables (I don't think this is a function of vanilla git) and when it should check (if it checks too often it's consuming bandwidth, if it check too infrequently it can mislead the user). RE: the "when", IMO it makes sense to refresh:
But anyway, I think that could address the issue. Thoughts? |
This is a function of vanilla git. See
Somehow it knows that local branch is out of date. There might be simpler ways to check it though. I'm not much into git tricks. |
I can see how auto fetching might mess up a local. The main functionality that I’m missing is auto updating “ahead/behind” badges in the sidebar. If it’s possible to update those without a fetch, I’d be all for that instead. |
Just wanted to add my support for this issue. I activated this exact feature in VS Code, however it works only when the project is open in VS Code. If I'm just checking a repo in Sublime Merge without having it open in VS Code, I will think it's up to date, because I'm used to that now, but it might not be. About ratijas's comment on To me, the idea behaviour would be to have the side bar in Sublime always up to date with the remote repo. In the same way that files changes are always up to date with the file system. The Fetch button, next to the Pull one, is a good idea too. See also #1313. |
Related: #1500 (comment) |
Excellent point, themilkman, |
Hi all, Thank you for sharing your feedback! We've added this in Sublime Merge build 2080 (development), and we're excited for you to try it 🎉 Kind regards, |
Hi @dpjohnst, Thank you for working on this feature and letting us know about it! It seems to be working well. Maybe it could be useful to be able to activate this "per-repository". I always have plenty of repos open, some of them shared with my team, some of them not. It makes sense to auto fetch often the shared repos, but not the others (for instance, my dot files repo: I only push to it). A way to implement this could be to add a checkbox when the main auto fetch setting is active. This is nothing more than a "nice to have" though, I'm pretty happy autofetching all my open repositories. Cheers! |
Hi @djohnston, extracted from a discord discussion a possible problem I see with the current implementation: |
Hi @themilkman, I believe that automatic fetching is not recommended if multiple persons are susceptible to commit on the same branch. However, in teams where no one ever commit on someone else's feature branch, automatique fetching is useful (to not have to fetch before checking out someone else's branch in order to review their PR, among others). Having multiple people committing on the same branch might be common in teams following the git-flow branching model, but I believe is less common and not recommended when following the simpler GitHub-flow. The git-flow author himself recommends GitHub-flow for simple and continuously delivered software. To conclude, I believe that turning ON or OFF this option really depends on the context you work in. And the fact that it is turned OFF by default is a good thing. (Personal note: in my team, no one commits on someone else's branch. I've had automatic fetching active in VS Code for a long time, and it works well for me. Having it now in Sublime is even better: the repo doesn't need to be opened in VS Code to be kept up to date.) |
Hi all, This has now been added to Sublime Merge 2083 (Stable) 🎉 Cheers, |
Problem description
One of the features I miss from Git Tower is that it automatically ran
git fetch
at intervals. This ensured that my tags, remote branches, and so forth were up to date, and reduced the likelihood of me wasting time trying to commit stuff to a branch that has changed upstream.Preferred solution
I would love if Sublime Merge periodically fetched repos for open windows, without needing me to explicitly initiate a fetch.
Alternatives
There are a lot of ways to approach this. At a low level, there could be a mechanism for automatically running commands when a window is opened or focused (maybe with a minimum amount of time since the last time the command automatically ran, in case users are swapping between windows regularly). There could be a mechanism for automatically running commands on a strict time interval. Either mechanism could be specific to fetching, and controlled via preferences. Etc.
Basically, all I care about as a user is that my sidebar stays up to date without needing me to babysit it, and the software isn't constantly pinging the server with fetch requests. :-)
The text was updated successfully, but these errors were encountered: