Live data from Hacker News

How to undo almost anything with Git (2015)

github.blog

11–20 of 84 posts

Re: How to undo almost anything with Git (2015)

#11

It's missing git revert merges git revert -m 1 88113a64a21bf8a51409ee2a1321442fd08db705

PSA: You can safely refer to those long "commit-ish" identifiers using just the first 7 or 8 chars (eg `88113a64`) without real risk of collision. Let alone in examples / gists!

Git will even warn you if the hash prefix you provide is ambiguous!

I had a collision the other day on a mediums-sized when using a 6 character hash and was surprised. Git let me know and told me which objects collided.

Re: How to undo almost anything with Git (2015)

#12
post #10
post #4

It has always bugged me that git commit --amend Doesn't automatically resign (or fail to resign if the key isn't available) a signed git commit message. Anytime there is a non-verified git commit message in my history you can be sure it's because I was a dummy on the original message.

Wait, seriously? I sign all my commits as habit and I `--amend` regularly. If this means my signature histories are broken…

  git config commit.gpgsign true

Re: How to undo almost anything with Git (2015)

#16

Git is one of those once-a-decade technologies that's compicated, user un-friendly, takes months to master and is absolutely worth it.

Why is it worth it? I've been happier with other vcs.

Curious, what do you currently use for version control?

Re: How to undo almost anything with Git (2015)

#17
This flowchart[1] has been useful to me a few times when I've been lost on how to fix something. I usually keep it as a bookmark, but I don't have it saved on this computer, so I just did a google image search and was able to fine it fairly quickly. A google image search for "git solution workflow" or "git fix flowchart" finds it right away, in case this tickles your brain in the future and you want to find it again, and vaguely remember it's easy to find through image search.

Edit: Updated the link to go to the site referenced in the image. Might as well send you to who developed it so they get some credit.

1: http://justinhileman.info/article/git-pretty/

Re: How to undo almost anything with Git (2015)

#18

Earlier quoted context omitted.

Why is it worth it? I've been happier with other vcs.

Curious, what do you currently use for version control?

I'm not that poster, but Mercurial is just as powerful and much easier to use.

Re: How to undo almost anything with Git (2015)

#20
post #19

For several months now I've been wondering how to get rid of a 700 MB data file that was accidentally committed to our shared git repo. Now everyone has it, and a clean pull takes forever. Appreciate any thoughts.

You should be able to run a command that cleans the git tree of the file in all commits. I’ve had to do it because of committed passwords in files.

https://stackoverflow.com/questions/35115585/remove-file-fro...

Post reply on HN