Posts tagged: git

All posts with the tag "git"

It's nearly impossible to completely loose a file if it is commited to git. It's likely harder to fully remove the fi...

git

Git commands such as , , all take a flag called . This can filter for only certain types of diffs, such as added (A),...

git

I've never found a great use for a global file. Mostly I fear that by adding a lot of the common things like files it...

git

Fugitive comes with a pretty sick way to commit files and see the diff at the same time with verbose commit. Opening ...

Code Review from the comfort of vim | Diffurcate

I often review Pull requests from the browser as it just makes it so easy to see the diffs and navigate through them, but there comes a time when the diffs get really big and hard to follow. That’s when its time to bring in the comforts of vim.

https://youtu.be/5NKaZFavM0E

This all stems from the great plugin by AndrewRadev. It breaks a down into a project. So rather than poping into a pager from git diff, you can pipe to diffurcate and it will setup a project in a tmp directory for you and you can browse this project just like any other except it’s just a diff.

...

How I configure git

Git can be a bit tricky to get configured correctly. I often stumble into config issues weeks after setting up a new machine that I did not even notice. These are my notes to remind me how I configure git.

How to use git cherry pick

~/git via 🐍 v3.8.5 ❯ mkdir git-cherry-pick-learn ~/git via 🐍 v3.8.5 ❯ cd git-cherry-pick-learn ~/git/git-cherry-pick-learn ❯ git init Initialized empty Git repository in /home/walkews/git/git-cherry-pick-learn/.git/ git-cherry-pick-learn on  main ❯ touch readme.md git-cherry-pick-learn on  main [?] ❯ git status On branch main No commits yet Untracked files: (use "git add ..." to include in what will be committed) readme.md nothing added to commit but untracked files present (use "git add" to track) git-cherry-pick-learn on  main [?] ❯ git add . git-cherry-pick-learn on  main [+] ❯ git commit -m "init readme" [main (root-commit) ebd1ff2] init readme 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 readme.md git-cherry-pick-learn on  main ❯ echo "Learn Cherry Pick" Learn Cherry Pick git-cherry-pick-learn on  main ❯ git add . git-cherry-pick-learn on  main ❯ git commit -m "add title git-cherry-pick-learn on  main ❯ echo "# Learn Cherry Pick" > readme.md git-cherry-pick-learn on  main [!] ❯ git add . git-cherry-pick-learn on  main [+] ❯ git diff git-cherry-pick-learn on  main [+] ❯ git diff --staged diff --git a/readme.md b/readme.md index e69de29..3490cef 100644 --- a/readme.md +++ b/readme.md @@ -0,0 +1 @@ +# Learn Cherry Pick git-cherry-pick-learn on  main [+] ❯ git commit -m "add title" [main 148264d] add title 1 file changed, 1...

Trim unused git branches

Trim branches no longer on origin ¶ # git remote prune origin --dry-run git remote prune origin Find branches already merged ¶ # git checkout main # list remote branches that have already been merged into main git branch -r --merged # list local branches that have already been merged into main git branch --merged

Gitui is a blazing fast terminal git interface

Gitui is a terminal-based git user interface (TUI) that will change the way that you work with git. I have been a long-time user of the git cli, and it’s been hard to beat, mostly because there is nothing that keeps my fingers on the keyboard quite like it, except gitui which comes with some great ways to very quickly walk through a git project.

Go to their [releases]https://github.com/extrawurst/gitui/releases) page, download the latest build, and pop it on your PATH. I have the following stuffed away in some install scripts to get the latest version.

install latest release

...

2 min read
git

Fix git commit author

I was 20 commits into a hackoberfest PR when I suddenly realized they they all had my work email on them instead of my personal email 😱. This is the story of how I corrected my email address on 19 individual commits after already submitting for a PR.

stop the bleeding

Before anything else set the email correctly!

...

3 min read
git

List the latest files to change in a git repo

while read file; do echo $(git log --pretty=format:%ad -n 1 --date=raw -- $file) $file; done < <(git ls-tree -r --name-only HEAD | grep static/stories) | sort -r | head -n 3 | cut -d " " -f 3
git

Strip Trailing Whitespace from Git projects

A common linting error thrown by various linters is for trailing whitespace. I most often use flake8. I generally have [pre-commit](https://waylonwalker.com/pre-commit-is-awesome hooks setup to strip this, but sometimes I run into situations where I jump into a project without it, and my editor lights up with errors. A simple fix is to run this one-liner.

bash

git grep -I --name-only -z -e '' | xargs -0 sed -i -e 's/[ \t]\+\(\r\?\)$/\1/'

pre-commit article

...

Master No More

It’s been a long time coming. We use some very harsh language within tech so much sometimes that we become numb to it. It’s time to do my very small part in this movement and purge this language from my active repos starting with this blog right here.

Large Refactor At The Command Line

this post follows my method of refactoring code bases from the command line, read more about that in this article.

...

2 min read
git