Tag: bash

Why does git freeze on git-credential-osxkeychain sometimes?

When I do cd some-repo; git push origin master in my bash terminal, it doesn’t ask me for username/password because I guess git has already saved that (it was so long ago that I don’t remember the details of how that went down). I’m pushing to a GitHub repo as the remote origin. So I […]

git bash : how to check if there's a new commit available

I use git with my friend to collaborate on a project. He created a repo in github consisting folders of each of our names, so everytime i update something, I upload it to this folder then push it to github, and so does he. So everytime there’s a new commit, we have to pull from […]

Bash in Git for Windows: Weirdness when running a command with CMD.exe /C with args

This is more of an annoyance rather than a problem but I would very much like to understand the semantics here. All I want to do is to run an arbitrary command on a temporary command-prompt session which itself running under a bash session. My success rate is 50/50 as some command works as expected […]

git scripting: How to list all git branches containing a commit

I can list all branches containing a certain commit using git branch –list –contains just fine. But as explained in the related question on how to list all branches, this is a porcelain command that should not be used in scripts. The latter question suggests to use the plumbing command git for-each-ref, but that does […]

Git: Show content of file as it will look like after committing

After reading Git pre-commit hook : changed/added files, the following question arose: Given I have a file with both staged and unstaged changes, how can I display a preview of the file’s contents after staging? Example: echo “foo” >> file git add file echo “bar” >> file Wanted output: [previous contents of file] foo

Automatically remove *.pyc files and otherwise-empty directories when I check out a new branch

So here’s an interesting situation when using git and python, and I’m sure it happens for other situations as well. Let’s say I make a git repo with a folder /foo/. In that folder I put /foo/program.py. I run program.py and program.pyc is created. I have *.pyc in the .gitignore file, so git doesn’t track […]

In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec

In Git Bash on Windows 7, I occasionally have something happen that causes the color coding to fail when running cucumber scenarios or rspec specs. Occasionally, it is randomly fixed (where randomly == I don’t know what I did to cause it to be fixed). So when I run: $ bundle exec cucumber features Or […]

ANSI color in git is not displayed correctly

Recently, I switched to SLES 11. I found a problem for git command. All the ANSI color could not be rendered. Instead, it shows the ANSI code like this: *ESC[33m*commit 0a02124a0fd85c1f0094bcdf15bac1645e3c8630ESC[m note: the ansi color in ‘ls’ works very well.

Reuse GIT_WORK_TREE in post-receive hook to rm a few files

I’ve used this ‘tutorial’ to set up a DSP environment: http://toroid.org/ams/git-website-howto (Yes, I don’t have a T). My workflow is very easy: Develop locally (D) Commit a few things Commit more things Push to Staging (and Github) (S) Test new code on Staging Push to Production (P) My code contains CSS files that are minified […]

git stderr output can't pipe

I’m writing a graphical URI handler for git:// links with bash and zenity, and I’m using a zenity ‘text-info’ dialog to show git’s clone output while it’s running, using FIFO piping. The script is about 90 lines long, so I won’t bother posting it here, but here’s the most important lines: git clone “$1” “$target” […]

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