Posts tagged: git

All posts with the tag "git"

25 posts latest post 2026-05-06
Publishing rhythm
May 2026 | 1 posts

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 [1] this post follows my method of refactoring code bases from the command line, read more about that in this article. c-s-f # [2] First off browsing through the content of my blog I found many references to master. I cannot completely whole-sale find and replace each one of them, because some of them are links that I do not own. Any set of instructions got upgraded from master to main - git checkout master + git checkout main There were countless cases of examples like this to comb through, but it feels good to have them purged of old language. rename routes # [3] Following yesterdays post, I am going to rename my markdown files /static/_redirects shorteners # [4] - /gdfm /blog/today-i-lear...
2 min read 💬 4

008

compare _ branch to _ with ** cli

1 min

006

Setup ** for _

1 min

005

** setup is _

1 min

Today I learned `git diff feature..main`

Today I learned how to diff between two branches. git diff feature..main Sometimes we get a little git add . && git commit -m "WIP" happy and mistakenly commit something that we just can’t figure out. This is a good way to figure out what the heck has changed on the current branch compared to any other branch. Example # [1] Let’s create a new directory, initialize git [2] and toss some content into a readme. mkdir git-diff git init echo "hello there" > readme.md git add . && git commit -m "hello there" cat readme.md After all of that, we have a git repository on our local machine with a single file readme.md that contains the following. hello there Create a branch and ✍ edit # [3] Let’s checkout a new branch called Waylon and change the word there to Waylon in our readme.md file, then diff it. git checkout -b Waylon echo "hello Waylon" > readme.md git add . && git commit -m "hello Waylon" git diff - hello there + hello waylon At this point we have one commit. Things are real...
2 min read

git push without setting upstream

Finally after years of hand typing out a full git push --upstream my_really_long_and_descriptive_branch_name I found there is a setting to automatcally push to the current branch. More realisitically I just did a git push let git [1] yell at me, and copying the suggestion. git config # [2] git config --global push.default current This one setting will now git push to the current branch without yelling at you that your upstream does not match your current branch. This helps me ship chnages faster as I am constantly chnaging projects and branches. References: [1]: /glossary/git/ [2]: #git-config
1 min read

Realistic Git Workflow

My git [1] workflow based on real life. Its not always clean and simple. sometimes things get messy The Clean Path # [2] [3] pull 👉 branch 👉 format 👉 work👉 add 👉 commit 👉 pull 👉 rebase 👉 push Pull # [4] As complicated as that seems it is pretty straight forward. When you sit down to work the first thing you do is to pull down the teams latest working “develop” branch from git. git checkout develop git pull Branch # [5] Next create a new branch with a name that will remind you of what you are working on. For your own sanity choose something descriptive. It is easy to get too many similar branches going and forget which branch is which. git checkout -b ingest_product_id_table Format # [6] If you know which files in existance that you will be editing before you start work it is a good idea to format them in a commit early on to keep your working commits separate from formatting. This will make it easier for reviewers to distinguish from your changes and formatting fixes. ...
7 min read
Rewrite History with Git

Rewrite History with Git

- rebase - git [1] commit –amend Unstage # [2] git reset -- <file> rage unstage to wipte out history of staged commit git reset --hard <file> Undo file # [3] - rage quit - git reset HEAD~n - removes modifications - keeps hitsory of changes and undoes them - git checkout HEAD~n – - keeps modifications - removes history - –SOFT - –HARD - –Mixed undo n commits back # [4] locally before push git reset HEAD~n after push git revert HEAD~n update .gitignore # [5] after push git rm -r --cached . git commit -am "Updated .gitignore" References: [1]: /glossary/git/ [2]: #unstage [3]: #undo-file [4]: #undo-n-commits-back [5]: #update-gitignore
1 min read

Update Git User

This morning I log into my VCS and check activity on my projects to find that someone else has been very active on my projects fo the last few weeks. I quicklyhover over the missing avatar to find that It’s Me. What’s wrong here, why do I look like two different people throughout the day! upon further investigation I see the issue. while setting up a new terminal environment I mistyped my email address by one character. After much searching and a few failed attempts I was able to fix it by following an article no longer available (2021) from https://help.github.com/articles. Bare Clone # [1] Clone the repo, note it must be a --bare clone. git clone --bare https://github.com/user/repo.git cd repo.git git-author-rewrite # [3] Curl down the git-author-rewrite script and edit the following variables OLD_EMAIL CORECT_NAME CORRECT_EMAIL curl https://gist.githubusercontent.com/octocat/0831f3fbd83ac4d46451/raw/c197afe3e9ea2e4218f9fccbc0f36d2b8fd3c1e3/git-author-rewrite.sh > git-author-...
1 min read

remove git cruft

inspiration # [1] My original inspiration for this post came from steven ostermiller’s blog post that no longer exists from my last check in May, 2024. https://blog.ostermiller.org/removing-and-purging-files-from-git-history/ I was able to find it on the way back machine though. https://web.archive.org/web/20240222195617/https://blog.ostermiller.org/removing-and-purging-files-from-git-history/ git log --all --pretty=format: --name-only --diff-filter=D | sed -r 's|[^/]+$||g' | sort -u git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch FILE_LIST' --prune-empty -f -- --all rm -rf .git/refs/original/ git reflog expire --expire=now --all git gc --aggressive --prune=now git push origin --force --all git push origin --force --tags cd MY_LOCAL_GIT_REPO git fetch origin git rebase git reflog expire --expire=now --all git gc --aggressive --prune=now References: [1]: #inspiration
1 min read