Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
chippy
Aug 16, 2006

OK I DON'T GET IT
Any recommendations for decent Git GUIs for Windows? I mostly prefer to roll with the command line anyway, but it's nice to have a graphical client to go to occasionally. I've been using SourceTree for years but the last few updates just seem to have made the UI progressively shitter so I figure it might be time for a change, if there's anything good about.

Adbot
ADBOT LOVES YOU

ToxicFrog
Apr 26, 2008


chippy posted:

Any recommendations for decent Git GUIs for Windows? I mostly prefer to roll with the command line anyway, but it's nice to have a graphical client to go to occasionally. I've been using SourceTree for years but the last few updates just seem to have made the UI progressively shitter so I figure it might be time for a change, if there's anything good about.

I've been happy with git-cola, but I've never used it on windows and have no idea how the feature set compares to sourcetree.

Sedro
Dec 31, 2008

chippy posted:

Any recommendations for decent Git GUIs for Windows? I mostly prefer to roll with the command line anyway, but it's nice to have a graphical client to go to occasionally. I've been using SourceTree for years but the last few updates just seem to have made the UI progressively shitter so I figure it might be time for a change, if there's anything good about.

GitExtensions is alright

B-Nasty
May 25, 2005

I use Git Extensions (https://github.com/gitextensions/gitextensions) which works really well. I never got into the "cross-platform feel" of SourceTree; GitExt feels more like a Windows application, as it should, since it is written in C# for .NET.

While using it, Ctrl-G will open a Bash shell for all your CLI needs.

raminasi
Jan 25, 2005

a last drink with no ice
I've tried a couple other GUIs because Git Extensions won't be winning any beauty contests but I always go back to it in the end.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
Sourcetree is the only answer

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

chippy posted:

Any recommendations for decent Git GUIs for Windows? I mostly prefer to roll with the command line anyway, but it's nice to have a graphical client to go to occasionally. I've been using SourceTree for years but the last few updates just seem to have made the UI progressively shitter so I figure it might be time for a change, if there's anything good about.

The standard Git for Windows comes with git gui and gitk commands. That's all you need! Keep it simple.

comedyblissoption
Mar 15, 2006

Blinkz0rz posted:

Sourcetree is the only answer

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
Does tig not work on Windows or something?

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

I'm hoping someone can help me unfuck my git repo. Here's what happened:
I made changes, commited and pushed to remote. This is fine.
Then I accidentally did a commit amend on the latest commit which was just pushed. So as i understand I won't be able to push anything because I hosed up that commit?
Then someone told me to fix it with reflog, but didn't explain exactly how, so I did reflog delete of the last amend, which is a wrong and bad thing to do?
So how do I just put my repo in the state it was in when I pushed last. And is that reference deletion going to gently caress me somehow?

Every time I have to do something non trivial with git I end up trying in vain to understand a single thing and so loving frustrated that I can barely function.

apseudonym
Feb 25, 2011

peepsalot posted:

I'm hoping someone can help me unfuck my git repo. Here's what happened:
I made changes, commited and pushed to remote. This is fine.
Then I accidentally did a commit amend on the latest commit which was just pushed. So as i understand I won't be able to push anything because I hosed up that commit?
Then someone told me to fix it with reflog, but didn't explain exactly how, so I did reflog delete of the last amend, which is a wrong and bad thing to do?
So how do I just put my repo in the state it was in when I pushed last. And is that reference deletion going to gently caress me somehow?

Every time I have to do something non trivial with git I end up trying in vain to understand a single thing and so loving frustrated that I can barely function.

Look up the sha of the commit you pushed (using reflog or whatever)

`git reset --hard <sha>`
To point your current branch back to that commit. done.

If you have things you did on top of that amended commit then use `git rebase --onto <sha> <commit>` to rebase them

Gounads
Mar 13, 2013

Where am I?
How did I get here?

peepsalot posted:

I'm hoping someone can help me unfuck my git repo. Here's what happened:
I made changes, commited and pushed to remote. This is fine.
Then I accidentally did a commit amend on the latest commit which was just pushed. So as i understand I won't be able to push anything because I hosed up that commit?
Then someone told me to fix it with reflog, but didn't explain exactly how, so I did reflog delete of the last amend, which is a wrong and bad thing to do?
So how do I just put my repo in the state it was in when I pushed last. And is that reference deletion going to gently caress me somehow?

Every time I have to do something non trivial with git I end up trying in vain to understand a single thing and so loving frustrated that I can barely function.

I think you want

git reset --hard SHA

Where SHA is the latest commit hash on the remote repo. That's assuming everything you care about is safe and sound in the remote repo.

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Is the remote SHA not supposed to match the local SHA? Does it matter which I use?

good jovi
Dec 11, 2000

'm pro-dickgirl, and I VOTE!

peepsalot posted:

Is the remote SHA not supposed to match the local SHA? Does it matter which I use?

Different commits have different SHAs, and that SHA never changes*. When you amended the commit, you actually made a whole new commit. The original commit, that you pushed out, is still hanging around, git just doesn't show it to you because it's an orphan (it doesn't have any branches pointing at it).

"git reset --hard <sha>" tells git to move the checked out branch to point at the commit <sha>. So if you run that with the SHA of the original commit, your current branch (I'm guessing master) will now point to the original commit that you pushed out, and the amended, bad commit will become an orphan.

*Barring some incredibly unlikely collision, a sha uniquely identifies a single commit across all git repos ever, anywhere.

good jovi fucked around with this message at 21:40 on Jul 28, 2016

apseudonym
Feb 25, 2011

peepsalot posted:

Is the remote SHA not supposed to match the local SHA? Does it matter which I use?

They should match unless you did a rebase or cherry-pick upstream. You can just fetch then do `git reset --hard origin/master` filling in the remote/brach you use.

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

good jovi posted:

Different commits have different SHAs, and that SHA never changes*. When you amended the commit, you actually made a whole new commit. The original commit, that you pushed out, is still hanging around, git just doesn't show it to you because it's an orphan (it doesn't have any branches pointing at it).

"git reset --hard <sha>" tells git to move the checked out branch to point at the commit <sha>. So if you run that with the SHA of the original commit, your current branch (I'm guessing master) will now point to the original commit that you pushed out, and the amended, bad commit will become an orphan.

*Barring some incredibly unlikely collision, a sha uniquely identifies a single commit across all git repos ever, anywhere.
What do you mean "become an orphan", that sounds like its still around in some way? Isn't it completely gone with no trace after a hard reset?

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


Commits still hang around even if no branches point to them or their children, at least until the next time git decides its time to garbage-collect (or you do it manually)

For the most part to find an orphan before it gets garbage collected and deleted forever you need the reflog or some serious digging through the .git structure (if there's a command to just find all orphans I don't know it)

nielsm
Jun 1, 2009



peepsalot posted:

What do you mean "become an orphan", that sounds like its still around in some way? Isn't it completely gone with no trace after a hard reset?

Objects in git stay in a repository copy even when nothing references them, until they are removed by garbage collection. By default, garbage collection also only removes objects after they have gone unreferenced for a grace period of 30 days or so. That gives you a chance to recover from many types of fuckups, as long as you had your files added in some way.

In fact, even just "git add" without a commit should still create an object for the file, as far as I understand. That file object is then referenced in the temporary tree object constructed up until a commit.

apseudonym
Feb 25, 2011

peepsalot posted:

What do you mean "become an orphan", that sounds like its still around in some way? Isn't it completely gone with no trace after a hard reset?

Git does not destroy commits, you have to work really hard to lose data. This is a big reason git rocks.

All amend does is create a new commit with the updated contents + message with a parent of HEAD~1 and updates the branch to point to it instead of the old HEAD. The commit is still there and you can find it in reflog. Same for rebases or any other operation.

Eventually git gc will go through and get rid of commits that aren't referenced anymore.

uXs
May 3, 2005

Mark it zero!

apseudonym posted:

Git does not destroy commits, you have to work really hard to lose data. This is a big reason git rocks.

Oh, cool.

apseudonym posted:

Eventually git gc will go through and get rid of commits that aren't referenced anymore.

So with 'work really hard' you actually mean 'just do nothing for a few days'.

apseudonym
Feb 25, 2011

uXs posted:

Oh, cool.


So with 'work really hard' you actually mean 'just do nothing for a few days'.

By default it doesn't prune things younger than 30 days. You can change that if you'd like.

E: wrong on the dates, it's 30 days for amend/rebase stuff. See the git gc docs.

apseudonym fucked around with this message at 00:17 on Jul 29, 2016

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

uXs posted:

So with 'work really hard' you actually mean 'just do nothing for a few days'.
There's no background daemon for the gc and in normal usage it very rarely runs, so it's more like "do nothing for a month, then do a whole bunch of stuff before realizing you want the things you deleted a month ago back"

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

peepsalot posted:

I'm hoping someone can help me unfuck my git repo. Here's what happened:
I made changes, commited and pushed to remote. This is fine.
Then I accidentally did a commit amend on the latest commit which was just pushed. So as i understand I won't be able to push anything because I hosed up that commit?
Then someone told me to fix it with reflog, but didn't explain exactly how, so I did reflog delete of the last amend, which is a wrong and bad thing to do?
So how do I just put my repo in the state it was in when I pushed last. And is that reference deletion going to gently caress me somehow?

Every time I have to do something non trivial with git I end up trying in vain to understand a single thing and so loving frustrated that I can barely function.

In addition to other answers I just want to note that there's nothing inherently wrong with force pushing as long as you understand the consequences. If you're the only one working on the repo or you're on a feature branch that no one else has touched feel free to git push --force as you're the only one who has a copy of the remote.

If someone else has pulled the remote and you amend history you have to worry about getting out of sync but even that isn't too hard to unfuck.

Gounads
Mar 13, 2013

Where am I?
How did I get here?

Blinkz0rz posted:

If someone else has pulled the remote and you amend history you have to worry about getting out of sync but even that isn't too hard to unfuck.

I've always refused to force-push and convinced my co-workers to follow the same rule. What is the right way to un-gently caress that situation?

o.m. 94
Nov 23, 2009

peepsalot posted:

I'm hoping someone can help me unfuck my git repo. Here's what happened:
I made changes, commited and pushed to remote. This is fine.
Then I accidentally did a commit amend on the latest commit which was just pushed. So as i understand I won't be able to push anything because I hosed up that commit?
Then someone told me to fix it with reflog, but didn't explain exactly how, so I did reflog delete of the last amend, which is a wrong and bad thing to do?
So how do I just put my repo in the state it was in when I pushed last. And is that reference deletion going to gently caress me somehow?

Every time I have to do something non trivial with git I end up trying in vain to understand a single thing and so loving frustrated that I can barely function.

What will really help is if you get a handle on how git actually structures commits and what branches are. See this: http://think-like-a-git.net/

I personally think it's impossible to know what you're doing in git until you understand the graph. Knowing that "git reset" is just moving a branch pointer to another node in the graph just means I can use it for all kinds of things, not just as a "I dun hosed up" button that most people seem to think it is (the name of the command doesn't help in this regard). Knowing that git commits exist even when you delete a branch, and what the reflog is for makes instant sense too.

Hughlander
May 11, 2005

Gounads posted:

I've always refused to force-push and convinced my co-workers to follow the same rule. What is the right way to un-gently caress that situation?

If I understand correctly:
code:

git reset HEAD^ --hard
git pull --ff-only

Drop your last commit, move to where master is.

ToxicFrog
Apr 26, 2008


Hughlander posted:

If I understand correctly:
code:
git reset HEAD^ --hard
git pull --ff-only
Drop your last commit, move to where master is.

If you're out of sync by more than one commit, or if you want to keep your latest commit, that won't work.

The general approach to "throw away all local work and get in sync with the remote" is
code:
$ git fetch
$ git reset --hard <remote/branch>
If you have local commits you want to keep, you'll need to do some merging and/or rebasing depending on situation and personal preference.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If you have local commits you want to keep you just do git fetch; git rebase -i origin/branchname and then remove the old versions of the commits that aren't yours. You can also do this non-interactively with rebase --onto, but that's way more complicated.

apseudonym
Feb 25, 2011

Plorkyeran posted:

If you have local commits you want to keep you just do git fetch; git rebase -i origin/branchname and then remove the old versions of the commits that aren't yours. You can also do this non-interactively with rebase --onto, but that's way more complicated.

Rebase --onto isn't complicated though.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If you aren't already familiar with manipulating the commit DAG it'll take a few reads of the man page to even understand what it does and how to call it. It's not that hard, but it's a lot harder to explain than "delete the lines with commit messages you didn't write".

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


I'm usually pretty good at reading DAGs and the Git version trees and I still have to go to the man page every time I think about using git rebase --onto :saddowns:

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
I cloned a project from our lab's git server via just git clone repo and no other options and now when I do things like git branch -r or git branch -a.

It doesn't list any remote branches. It's a bit annoying and I figured out the problem is somehow related to the option --depth 1 being passed to my original git clone or whatever. I checked the config file and on StackOverflow but I can't seem to figure out how to reset the clone depth so that it lists all branches, both local and remote.

Is there a way I can do this without just re-cloning the entire thing and if not, what option do I augment the clone command with? Can I just do --depth 100 or something large and call it a day or is there a more "correct" option to use?

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Boris Galerkin posted:

I cloned a project from our lab's git server via just git clone repo and no other options and now when I do things like git branch -r or git branch -a.

It doesn't list any remote branches. It's a bit annoying and I figured out the problem is somehow related to the option --depth 1 being passed to my original git clone or whatever. I checked the config file and on StackOverflow but I can't seem to figure out how to reset the clone depth so that it lists all branches, both local and remote.

Is there a way I can do this without just re-cloning the entire thing and if not, what option do I augment the clone command with? Can I just do --depth 100 or something large and call it a day or is there a more "correct" option to use?

Probably
code:
git fetch --all --unshallow
.

smackfu
Jun 7, 2004

As a git novice, I really do love the command line interface. It tends to have great little helpful messages that would otherwise require Googling.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

smackfu posted:

As a git novice, I really do love the command line interface.

This is probably the only time I've ever read anyone praising gits UI.

comedyblissoption
Mar 15, 2006

quote:

Master Git and a novice were walking along a bridge.

The novice, wanting to partake of Master Git’s vast knowledge, said: “git branch --help“.

Master Git sat down and lectured her on the seven forms of git branch, and their many options.

They resumed walking. A few minutes later they encountered an experienced developer traveling in the opposite direction. He bowed to Master Git and said “git branch -h“. Master Git tersely informed him of the most common git branch options. The developer thanked him and continued on his way.

“Master,” said the novice, “what is the nature of long and short options for commands? I thought they were equivalent, but when that developer used -h you said something different than when I said --help.”

“Perspective is everything,” answered the Master.

The novice was puzzled. She decided to experiment and said “git -h branch“.

Master Git turned and threw himself off the railing, falling to his death on the rocks below.

Upon seeing this, the novice was enlightened.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!

Edison was a dick posted:

Probably
code:
git fetch --all --unshallow
.

This gave me the error "--unshallow on a complete repository does not make sense". I just deleted the repository and re-cloned it with just clone (no options) and git branch -a lists remote branches now so :iiam: but problem solved.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
So I'm actually browsing our git repository on our gitlab site and holy poo poo this UI is a loving disaster. I have/had my browser snapped to one side/half of my monitor so the ~responsive design~ decided to get rid of all the labels on the menu bar on the left. Maybe I'm just too old (I'm 28...) but the icons they decided to use make no god drat sense to me and aren't very intuitive, specifically the activities (speedometer), milestones (a loving clock), merge request (a server rack??), and snippets (pieces of paper). I tried to look for a way to change my settings to maybe see if it can just force display the labels so I clicked on 'profile settings' but wasn't expecting the sidebar to replace the icons with different options so I spent 10 seconds of my life upset that "profile settings" literally only lets me change my profile information before realizing the sidebar changed.

Now I wasted a minute of my life posting this.

Is there a userscript I can install or something to change the entire UI to Github's UI? I mean that one at least makes perfect sense and I'm used to it.

Boris Galerkin fucked around with this message at 09:57 on Aug 15, 2016

necrotic
Aug 2, 2005
I owe my brother big time for this!

Boris Galerkin posted:

So I'm actually browsing our git repository on our gitlab site and holy poo poo this UI is a loving disaster. I have/had my browser snapped to one side/half of my monitor so the ~responsive design~ decided to get rid of all the labels on the menu bar on the left. Maybe I'm just too old (I'm 28...) but the icons they decided to use make no god drat sense to me and aren't very intuitive, specifically the activities (speedometer), milestones (a loving clock), merge request (a server rack??), and snippets (pieces of paper). I tried to look for a way to change my settings to maybe see if it can just force display the labels so I clicked on 'profile settings' but wasn't expecting the sidebar to replace the icons with different options so I spent 10 seconds of my life upset that "profile settings" literally only lets me change my profile information before realizing the sidebar changed.

Now I wasted a minute of my life posting this.

Is there a userscript I can install or something to change the entire UI to Github's UI? I mean that one at least makes perfect sense and I'm used to it.

Doubt there's a full "Github UI" script. Gitlab does have a lovely UI, though. It was way better before they did the overhaul.

Adbot
ADBOT LOVES YOU

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
On the subject of gitlab, does anyone have any experience with setting up a doxygen branch to host the doxygen generated files? We have no documentation in our code right now and my supervisor doesn't really believe in it (we're a research group comprised of non-programmers other than me and my supervisor thinks it's a good exercise for all his phd students to figure out what the gently caress poo poo like "eocs = 0.9887342" comes from or even means). I'm doing a rewrite of the entire code we use (changing backend libraries) and I figured gently caress it, I'm going to document everything the way god intended and grabbed Doxygen, but it's not really feasible to track the doxygen generated folder since everything changes so much.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply