Post details
Splitting a git repo into two, while retaining all history.
Splitting a git repo into two, while retaining all history.
Prevent pushing to “main” locally with this git config snippet. It doesn’t rely on setting up the remote branch protections, though you should also do that.
Getting symlinks to work with a git clone
on Mac (2 mins read).
How to restore symlinks in a previously cloned repository, where core.symlinks=false
.
89 things I know about Git commits (7 mins read).
Some of the things I've learned over a decade of Git usage, and working on writing good commit messages.
Stick the following in your ~/.gitconfig to make `git branch` sort by most recently committed (thanks to @wingo@mastodon.social for this one!): [branch] sort = -committerdate
I'd like to be able to do this: git cherry-pick --interactive hash-0..hash-n-1 # fantasy command and obtain the same workflow as interactive rebase: an editor buffer comes up, containing: pick ...
Learn how to create a simple Makefile to quickly create a "checkpoint" in your Git history when you are rapidly prototyping.
Pressing "enter" on an empty buffer displays an information-rich and pretty dashboard. - chrisgrieser/zsh-magic-dashboard
It's hard to see why "clean" Git commits are useful if you've never done a good `git blame` or `git bisect`. It's also hard to see how useful `git blame` and `git bisect` can be if your Git commits are a mess. Not sure where I'm going with this. #git
PSA: Do not put git repos inside other git repos. Git is not a package manager. You will make yourself sad. It doesn't matter how many conceptual primitives they share. Don't do it. Just use a package manager. You don't even need a package repository. You can still download things directly from git repos if you want to. Just list them in a package.json or something, and let npm do it. Or go.mod. Anything. Please. For your own sake. And everyone who comes after you.
I’m pretty sure the most impactful thing I did this week was teach a colleague to git add with -p. And I feel pretty good about that. Context in case it’s useful: - p is for patch. Command ‘git add -p’ presents the user with all their unstaged changes, one chunk at a time, and prompts for whether to add it or not. This is better than using a dot to all your local changes, or having to type long file paths to pick up just a few files and ignore others. Try it!
Something cool newer #git versions are doing - you'll now see Reapply
instead of Revert Revert ...
in commit messages, if you're reverting a revert.
In an older version of Git (i.e. with 2.34.x) you would see:
Revert "Revert "Commit title here""
Revert "Commit title here"
Commit title here
However, in newer versions (i.e. with 2.43.x) you now see:
Reapply "Commit title here"
Revert "Commit title here"
Commit title here
Which makes it a little bit cleaner in your Git log
Merge vs. Rebase vs. Squash. Anyone who says "100% of the time you <merge/rebase/squash>" is wrong and I'm strong in that opinion. I'm asked about this pretty regularly, so I decided to take my copy paste answer I always use and put it in a gist. 🍿 https://gist.github.com/mitchellh/319019b1b8aac9110fcfb1862e0c97fb
Attached: 1 image git discussion bingo card
When you work on a project with squash-and-merge as a strategy, you end up splitting concepts across multiple pull requests to make coherent git history that could be untangled later if needed. Teams throw away the context because they have poor git commit practices, but they have poor git commit practices because they throw all that context away ...
Importing a subdirectory from one repo into another (1 mins read).
How to import a subdirectory of a given Git repository into another one, using git subtree
.
I'm having trouble finding out which tag is currently checked out. When I do: git checkout tag1 git branch I can't seem to find out which tag I'm on. It only logs: * (no branch) master Is it
GitHub switched to performing merges and rebases using merge-ort. Come behind the scenes to see why and how we made this change.
Merging a branch in GitHub - the hard way (4 mins read).
How to (kinda) merge two branches in GitHub using the underlying Git database API.
:train2: London Tube Map via a Git Network Graph. Contribute to quarbby/london-git development by creating an account on GitHub.
Yesterday I used the "git filter-repo" command for the first time. Have not felt such a thrill of power/danger since I first learned about "git rebase -i".
Intended audience: software engineers working with Git who happen to come across this value and want to confirm that it has particular significance.
Performing bulk changes across Git(Hub) Repos with Turbolift and Microplane (4 mins read).
Using Turbolift and Microplane to enact changes across many Git(Hub) repositories.
Nice! If they're useful to keep I'll use git commit --fixup
into a parent commit (so I can then git rebase -i --autosquash) or into a commit called
DROPME` to remind me to get rid of that commit when I'm ready to go
If you have a local setup, just for you, and want it stored, here's how to do it, while leaving no footprints in the git repository.
Just add the following to your ~/.gitconfig [format] signOff = true git-scm.com/docs/git-confi…tommoulard (@tom_moulard)Thu, 04 Aug 2022 08:22 +0000
Matthias Ott is an independent user experience designer and developer from Stuttgart, Germany. Besides design practice he teaches Interface Prototyping at the Muthesius Academy of Fine Arts and Design, Kiel.
Weirdness with git diff-index
showing 1 file changed, 0 insertions(+), 0 deletions(-)
(1 mins read).
Something weird I hit last week with git diff-index
, which shows 1 file changed, but no changes.
git add -p is your best friend. Even if you state it all anyway. Oh and git commit -v 🥹
Felipe Sere (@felipesere)Sun, 08 May 2022 22:17 +0000
That's an exaggeration, if you've done `git status` and have seen what would be staged, then `git add .` can be okay, but even then we'd be better recommending `git add -pi`, which allows interactive staging of files; no more committing stuff you didn't mean to.
Emelia 👸🏻 • 💙💛 (@ThisIsMissEm)Mon, 09 May 2022 12:49 +0000
Here’s something interesting for you, @spences10 and @eddiejaoude; since you both posted interesting Git content this morning. There’s no such thing as a fork.David Flanagan (@rawkode)Sun, 08 May 2022 09:28 +0000
I have been a Vim user for 12 years and one important thing that you learn the first days using it is that you can be super efficient…
Determining if there are uncommitted changes in Git (1 mins read).
A one-liner to work out whether there are uncommitted changes in a repository.
Another new release of Git is here! Take a look at some of our highlights on what's new in Git 2.36.
Prefactoring: Preparatory Refactoring (2 mins read).
Why I use prefactoring as a means to perform up-front refactoring for codebases, splitting these into separate PRs/MRs where possible.
I think https://learngitbranching.js.org/ has a section on rebasing
Don't wait until you have an emergency to learn about git rebasing and cherrypicking. You won't need them often; but it's a superpower to be able to say; "I know how to fix this problem, here's what you do..."
assertchris (@assertchris)Tue, 12 Apr 2022 05:26 +0000
Exporting a Git repo as an archive (1 mins read).
How to export a Git repo as an archive format, such as a .tar.gz
or a .zip
.
Pull requests predate Github though.
Gustav Wengel (@GeeWengel)Sat, 25 Dec 2021 12:47 GMT
You're currently viewing page 1 of 3, of 136 posts.