Github desktop - how do I refresh from master
-
I was working on a little project in two places, and I thought I'd synced up to Github. Then I wound up working on it on another machine, and pushed several revisions. Now the first machine is outdated, and wants to push a (relatively) huge commit that would undo all that work. How do I tell Github Desktop to refresh from Github and throw out local changes?
-
The Sync button will pull down the changes:
To revert the local changes first, you want to right-click on the changes you want to get rid of:
-
When I hit sync it built a proposed commit for me. I dried discarding all the changes, and when I tried to resync it wound up undoing all my discards.
the master has 19 new files, local has 3 conflicts. SO suggests git --reset hard, from a command-line.
-
ah yeah, you have to do a commit to resolve a merge conflict for some reason, so without a commit, it's going to think you're conflicted forever. You probably do need to drop to command line, just open a "git shell" (right-click the project name) and type the command there.
-
Git status from shell suggests git pull.
Would nuking three local files with conflicts and then pulling from commandline or syncing from Desktop work?
-
Ideally there should be a "git pull xxxxxx" where xxxxxx is a commit ID that would reset local to the ID specified.
-
You should be able to
git reset --hard <commit hash>
, thengit pull
.
-
-
You should be able to
git reset --hard <commit hash>
, thengit pull
.A---B---C---D---E---F---G \---x
I'm at x and I want to be at G. should I use the hash for D in the reset?
-
It's Git. Ideal doesn't exist.
Yes, I know. If I were working purely with CLI I'd just delete the entire local repo and pull, but I don't know if that'll confuse GH Desktop.
-
Do you want to get rid of that branch, too? You should be able to just switch branches then. Or do you want to get your branch to state G?
-
Do you want to get rid of that branch, too? You should be able to just switch branches then. Or do you want to get your branch to state G?
I never explicitly created a branch. I managed not to commit x by mistake, then pulled E from another computer and committed a few times. All I want to do is get the local repo to state G; abandoning x is acceptable, as it was only a few lines.
-
Oh, in that case,
git stash
thengit pull
should do it.Don't worry about stashed changes, they'll get cleaned up eventually.
-
Oh, in that case, git stash then git pull should do it.
I think his concern is what fixing it at the CLI will do to GitHub Desktop.
-
Yeah. Actually git stash failed with a "couldn't update indexes" or something error, so I went for broke and did git reset --hard <hash of the head in master>, which made local sync with head, and I'm set now.
-
Note to self: never use GitHub for Windows. Ever.
-
LOL!
Well, what @Yamikuronue said up top SHOULD have worked. Or, ideally, there should have just been a "revert back to <commit>" right there in the GUI.
As far as I can tell, Desktop's barely got any documentation at all, unless there's more than what you can find on desktop.github.com.
-
wants to push a (relatively) huge that
I want to push a (relatively) minor grammatical fix that would correct all your sentences.
-
-
-
?
-
I want to push a (relatively) minor grammatical fix that would correct all your sentences.
I think you'd break @Frostcat Desktop.
-
Better?
-
Note to self: never use GitHub for Windows. Ever.
I use it to launch git shell because it acts as a credential helper and saves me from typing my GitHub password constantly. But yeah, GitHub Desktop isn't very good...
-
It actually just installs an SSH key onto your GitHub account the first time you log in. I use it the same way.
-
Yeah, I'm just referring to this line in the system git config:
[credential] helper = !github --credentials
You can use it with an existing git installation if you set it as a custom shell, which is what I do since the built-in git is super outdated.
git worktree
is a nice thing to have.
-
-
But yeah, GitHub Desktop isn't very good...
It was better 6 months ago. They did this big re-write and basically make it confusing and annoying.
-
-
Note to self: My friend confessed she passed the test and we will never
useGitHub for Windows. EverDays dawn and skin's crawling...
Days dawn and skin's crawling.
-
-
For all of you who say never use Git(Hub) - WOMM!
-
Yeah, I'm just referring to this line in the system git config:
[credential]
helper = !github --credentialsYou can use it with an existing git installation if you set it as a custom shell, which is what I do since the built-in git is super outdated. git worktree is a nice thing to have.
If you installed Git for Windows yourself and have a recently modern install ( > 2.0 should work IIRC) you can actually use the Windows credential cache straight out of the box. Just put this in your Git config:
[credential] helper = wincred
No need for Github's GUI.
-
Solution to the OP's problem: you do not refresh from master, it's the master who can choose to refresh you.
-
Interesting, I'll have to try that out next time I have access to my dev machine. I've never used Windows credentials before.
-
@JBert so I found an old reminder about this post, and tried to check it out. It looks like
wincred
is part of msysgit, not Git for Windows. At least, it doesn't exist anywhere on my system and I have Git for Windows 2.9.2.windows.1 installed.
-
@LB_ It's been a year since I last used Git in Windows, but that definitely worked back then, and I didn't have msysgit installed.
-
Ah, apparently it's not an actual executable but is instead built-in to git:
If you’re using Windows, you can install a helper called “wincred.”
-
@LB_ said in Github desktop - how do I refresh from master:
It looks like wincred is part of msysgit, not Git for Windows. At least, it doesn't exist anywhere on my system and I have Git for Windows 2.9.2.windows.1 installed.
msysgit became Git for Windows.
-
@powerlord Ah, TIL. Looks like msysgit is actually the development environment used to compile Git for Windows.
-
The first step to refreshing from master on Windows is to install SourceTree. :P