Live data from Hacker News

Git Exercises

gitexercises.fracz.com

31–40 of 45 posts

Re: Git Exercises

#31
post #28
post #24

Earlier quoted context omitted.

Regarding 2, that branching strategy sounds completely reasonable and simple. You wouldn't except to delete the "dev" branch in that case, nor squash any commits, because "dev" is a shared branch that many people use. It sounds like a classic "test" or "pre-production" branch. You would expect people to commit cleaned up commits ready to be merged to production into that branch. Any exploratory work would be done out…

> I didn't understand the part about removing the repository He was just saying that it could all be "solved" by simply nuking the current repository and starting afresh from the current version of the code. They'd lose all history but they'd also have a clean slate and not have to deal with the errors of the past.

I see. Also known as the "version control is hard, let's go shopping" route.

Better not let it come to that. Especially if the plan is to repeat it when someone mess up next time.

Re: Git Exercises

#32

Responding in hopes some Git non-novices are here and can give some quick advice. I have a fairly large Git repo with 5 years of commits from numerous team members including a bunch of non-technical people who had never used Git before. There were two major issues: 1. We started off storing binary files -- mostly images, but also a ton of raw data files that got versioned every day or two -- in this repro and it spir…

Regarding 1, I’ve found this Bash script [1] to be helpful in the past. In short, it lists all Git objects sorted by size — a good gut check for whether BFG or git filter-branch worked as you intended.

[1]: https://stackoverflow.com/questions/10622179/how-to-find-ide...

Re: Git Exercises

#33

Responding in hopes some Git non-novices are here and can give some quick advice. I have a fairly large Git repo with 5 years of commits from numerous team members including a bunch of non-technical people who had never used Git before. There were two major issues: 1. We started off storing binary files -- mostly images, but also a ton of raw data files that got versioned every day or two -- in this repro and it spir…

> obviously the problem could be immediately "solved" with rm -rf .git && git init, but...

No buts about it. This is the way to go. That commit history is mostly junk. Its value is extremely limited and it's hanging around only because of fear and nostalgia. Archive it somewhere as read-only so that the worry warts will hush up and can reference when they need to (which IRL will be once or never), but just get rid of it in the live repo. The headaches you'll save yourself by starting fresh will vastly outweigh the problems you're afraid will happen.

Re: Git Exercises

#34
post #27

Thanks for the resource! I've noticed that if I run a clone `git clone https://gitexercises.fracz.com/git/exercises.git ` it gets cloned in "DETACHED HEAD" mode and I need to checkout master, i.e. `git clone https://gitexercises.fracz.com/git/exercises.git -b master`. Any idea why that is? (It ultimately wasn't a problem once I switched to master, but without doing so there would be no configure.sh script either and…

It's a part of the exercise.

Re: Git Exercises

#35

Responding in hopes some Git non-novices are here and can give some quick advice. I have a fairly large Git repo with 5 years of commits from numerous team members including a bunch of non-technical people who had never used Git before. There were two major issues: 1. We started off storing binary files -- mostly images, but also a ton of raw data files that got versioned every day or two -- in this repro and it spir…

I’ve seen #2 happen once or twice but never did figure out exactly what the person who generated the duplicate commits had done. I suspect that they made some mistakes while rebasing a feature branch.

Re: Git Exercises

#36

Responding in hopes some Git non-novices are here and can give some quick advice. I have a fairly large Git repo with 5 years of commits from numerous team members including a bunch of non-technical people who had never used Git before. There were two major issues: 1. We started off storing binary files -- mostly images, but also a ton of raw data files that got versioned every day or two -- in this repro and it spir…

For 1), try using git-filter-repo (https://github.com/newren/git-filter-repo). This is the currently recommended alternative to previous tools like filter-branch, and it is much more user-friendly.

`git filter-repo --analyze` will generate a report of blobs stored in the repo at `.git/filter-repo/analysis/blob-shas-and-paths.txt`, and it's very easy to sort them by filesize and strip them out from there.

Re: Git Exercises

#38

Responding in hopes some Git non-novices are here and can give some quick advice. I have a fairly large Git repo with 5 years of commits from numerous team members including a bunch of non-technical people who had never used Git before. There were two major issues: 1. We started off storing binary files -- mostly images, but also a ton of raw data files that got versioned every day or two -- in this repro and it spir…

Regarding problem 2: It's hard to know what exactly you're seeing, but be aware that the output of "git log" is only pretending to be linear; it's really a tree/graph. ("git log --graph" can help, but the output can also be annoying to parse.) So when you see multiple copies of a commit "in a row", chances are that they are really present on different branches which were later merged. If they have the same commit ID, I would probably call this just a display quirk -- there's really only one "copy" in truth, but for some reason the history is confusing "git log". But if they have different commit IDs, that means (as far as I know) that someone has done a "git rebase" or a "git cherry-pick", which you didn't mention in your description.

Re: Git Exercises

#40
post #2

Excited to give this a try and see if it will help me expand my day-to-day git-fu. I like interactive learning resources like this. A similar one was posted to hn a while back for postgres and going through it taught me a lot. https://pgexercises.com/

Thanks for this :). A few more: https://jskatas.org https://www.flexboxfroggy.com https://www.cssgridgarden.com

https://flukeout.github.io/ https://deadlockempire.github.io/ https://fightcodegame.com/ https://play.elevatorsaga.com/
Post reply on HN