Tag: bash

Bash: How to run command expecting quotes using a variable?

I have a git command that I would like to run in my script: git filter-branch -f –env-filter “STUFF HERE IN QUOTES” The thing is, in my script I am dynamically creating the string that is represented by STUFF HERE IN QUOTES: ENVFILTER=”” while read commit; do IFS=”|” read date hash message <<< “$commit” DATE_NO_SPACE=”$(echo […]

bash/zsh prompt displaying Git repository data right-aligned

I saw this in a Github video and would like the same right-aligned prompt in my shell. How can I accomplish it? or even better Which prompt is used here?

git pre-status or post-status hook

I would like to run a linter on git status, however there seems to be no pre-status nor post-status hook. How could one add a hook to git? The fine docs are suspiciously silent on the matter! I’m currently wrapping my linter and git status in a Bash script, but I would prefer a solution […]

unable to see git color in Cygwin

I am still unable to see git output in colored format. I have all the required setting as mentioned in various SO questions. Screen from Git: Screen for Git Bash: Here is my git config file ashish /cygdrive/c/my-data/code/sample(integration) $ git config –list core.symlinks=false core.autocrlf=false color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true http.sslverify=false […]

git hooks bash — getting the commit message

I am writing a git hook, to run on a commit to the main branch. I need it to parse and look for some text in the the commit message. How do I reference the commit message in my bash script? Also I would like to know how to run the hook only on commits […]

Windows Git Bash – ulimit – too many open files

I wanted to increase the limit on the number of open files on Windows 7 (64-bit). Using Git Bash for my command line environment, I enter the following command: $ ulimit -n 9999 However, I encounter the following error: bash: ulimit: open files: cannot modify limit: Too many open files I would appreciate if you […]

Git – Rename multiple branches

Here we have a git repo which has multiple branches which start with the same prefix just like this: pfx.branchName1 pfx.branchName2 pfx.branchName3 … So the question is how to quickly remove all the prefixes (“pfx.”) from all the branches and get something like this: branchName1 branchName2 branchName3 …

git ps1 bash not loading on Lion

I have the following in my .bashrc file: # Git Bash Completion source “$HOME/.git_completion” GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASHSTATE=1 # Prompt export PS1=”\e[0;35m\u@\h\e[m \e[0;34m\w$(__git_ps1):\e[m\r\n” This should be displaying the git branch at the end of my prompt… but it’s not. If I manually source my .bash_profile, it works (my .bash_profile loads .bashrc). If I quit terminal and startup […]

bash: check if a particular git repository has github as remote repo?

I was wondering if it is, at all, possible to check if a git repository is using github.com as remote repository, and get the url for it via bash? Any help will be appreciated.

Git won't add certain globs

I’m left scratching my head on this one. So, in git on OSX, you can add files like: git add *.java and it will add all files that have the *.java extension. Same for .txt, json, etc. However, when I do a git add *.xml nothing happens. It’s not specified in my gitignore, so git […]

Git Baby is a git and github fan, let's start git clone.