New answers tagged

1

You need to delete your local libgmp completely: rm /usr/local/lib/libgmp.so* There's no need to run ldconfig afterwards. ldconfig makes sure the appropriate symlinks are present; libgmp.so.10 is a symlink to the latest library with that soname (run ls -l /usr/local/lib/libgmp.so* before deleting the files to see what I mean). Previously you deleted that ...


0

Thanks for all your answers! I ended up up putting this in my .bash_profile (on Mac): parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "


2

find "$DIR_TO_CLEAN" -type d -empty -delete -print Can remove -print to not get list of deleted directories. Edit: If you do not want to remove the "$DIR_TO_CLEAN" directory itself, add -mindepth: find "$DIR_TO_CLEAN" -mindepth 1 -type d -empty -delete -print


2

You probably meant dirs_to_check="$(echo "$changed_files" | xargs dirname | sort -u)" A simple solution, unless you have thousands of directories, is simply to try to rmdir each directory and ignore the errors. find . -depth -type d -exec echo rmdir --ignore-fail-on-non-empty {} + Change . to the top of the directories concerned. If your rmdir doesnt ...


0

You can install https://github.com/nojhan/liquidprompt Which will show dev ± where ± means git and dev is the git branch you are currently in.


10

The most standard way is to use __git_ps1 directly from git. In Ubuntu, it is available in this path: source /usr/lib/git-core/git-sh-prompt ## source /etc/bash_completion.d/git-prompt #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(__git_ps1 "(%s)")\$ ' You can notice the added part $(__git_ps1 ...


3

You would probably be happier with this: is there a .git folder here or in one of my parent directories? in_git () { local dir=$PWD until [[ $dir == / ]]; do [[ -d "$dir/.git" ]] && return 0 dir=$(dirname "$dir") done return 1 } Then your prompt is PS1='[\u@\h] \w ...


1

Change your PROMPT_COMMAND as follows: PROMPT_COMMAND="$PROMPT_COMMAND; if [ -d .git ]; then ingitrepo='GIT '; else ingitrepo=''; fi" Change your PS1 as follows: PS1='[\u@\h] \w ${ingitrepo}\$ ' Note that single-quotes are used when setting PS1 to prevent premature variable resolution, and also note that a backslash before $ at the end of your PS1 is ...


2

I also have a bunch of git repos and back them up upon logout, reboot or shutdown with rsync to my cloud. Its the simplest solution you will find out there. I also heard about bup(https://github.com/bup/bup), but never used it, so I cannot tell you how well it works. Myself, I wouldn't use git to backup multiple git repos (as I don't need a history of ...


2

Git over git is just a little crazy :) Try to add to gitignore dir with your repositories. Add in your cron script command to archive your repositories before commit. (Optioal) Setup auto commit/push to all your included repository. IMHO, 1 & 2 will be good for you. cd /home tar -zcvf my-gits-backup.tar.gz path/to/git/projects git add . git commit ...


0

If you're using ag or ack, this is what works: ag -l PATTERN | xargs git add



Top 50 recent answers are included