Skip to content

Instantly share code, notes, and snippets.

@showaltb
showaltb / bash_prompt.md
Last active May 23, 2023 17:51
Show changed or untracked files in bash prompt

Here is how to have your bash prompt tell you if you have changed or untracked files in your working directory.

Add these lines to ~/.bash_profile:

source /usr/local/etc/bash_completion
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
export PS1='\u@\h \w$(__git_ps1) \$ '
@showaltb
showaltb / gist:1ef9e196bc5ae404ef9c
Last active April 2, 2024 01:27
Handling Gemfile.lock conflicts during "git rebase"

If both the upstream and your feature branch have made changes to Gemfile, you will likely receive merge conflicts on Gemfile.lock when you rebase your feature branch. Don't try to resolve these manually; you'll probably just screw it up. Instead do this:

git checkout --ours Gemfile.lock
bundle
git add Gemfile.lock
git rebase --continue

This ensures that you get a correct Gemfile.lock at each step along the way.