Tag: bash

Convert git date using GNU date

I would like to convert the git date into the format of Ymd. Here’s my attempt: $>>git log -1 –format=”%cd” | xargs date Y%m%d But this returns this error: date: extra operand ‘Thu’ Try ‘date –help’ for more information. Any ideas how to convert git date like this: Thu Sep 19 17:03:12 2013 +0100 To […]

How do I configure Console2/Git Bash to run different scripts in different tabs?

Firstly, my apologies for possibly incorrect terminology. I’m coming at this from a windows background and have only Windows and DOS knowledge with which to express my needs. Background I am using Console2 to run Git Bash in 2 different tabs. These tabs are setup to start in different working directories so as to default […]

How to echo multi-line output from captured command?

I would like to echo the output from a command in the same format that it would output when I run a command on the terminal, but for some reason, using echo seems to eliminate newlines. Example: $ OUTPUT=$(git status) $ echo $OUTPUT # On branch feature_install # Untracked files: # (use “git add <file>…” […]

Git: Get line count for all different file types in a repository

How would I get the line count for all the different file types in my repository? So for example, if my repository contained 3 file types: java xml (no file extension) I want the output to be something like this: java 150 xml 20 (no file extension) 30 I can run a command that will […]

show git modifications on the command prompt within windows git-bash

I would like to display file changes (add, modify, delete) on the git bash command prompt similar to using (a) posh-git with powershell and (b) vcprompt on cygwin. Problem with (a) is that powershell aliases clash with my bash ones I’d like to use. Problem with (b) is that I don’t want to install both […]

Post-receive, request php script, pull git repo

I have a PHP script git.php on my web-server with only a few lines, one of the lines uses shell_exec() to run a ‘git pull ssh://user@X.com/repo.git’ (Please note, you cannot push to the webserver, this is disabled and cannot be enabled. ) This all works fine if you go to example.com/git.php. The script runs and […]

Howto sync database with git and git hooks and howto debug if it doesn't work

On OS: Ubuntu 12.04 I’ve got a drupal deployment (live website) and a staging environment (test website) on my server. Each time I pull changes from my staging website I want to synchronize the database automatically, as instructed here: http://ben.kulbertis.org/2011/10/synchronizing-a-mysql-database-with-git-and-git-hooks/ The setup I use is exactly the same (with settings and paths according to my […]

Is it OK to automate Git commands?

I’m coming from FTP, where if I wanted to edit some text quickly, I could just upload the file and see the change. I know I need to use Git, so I have automated the 3 step process (add, commit, push) using Bash shell programming. Is this OK to do? // in .bashrc file launch() […]

The Git Bash console crashes on open

I have been using Git Bash version 1.9.5 on Windows 8 successfully for a few weeks. This morning it stopped working. Every time I open Git Bash it shows up for a second and then crashes. I have searched everywhere for solutions; every forum says to uninstall Git and re-install a newer version. I have […]

Merging a tagged commit into a branch

I’m currently trying to merge a tag into a branch. The tag is not, I would consider, of an unusual format but Git persists on displaying Vim to enter a merge message even with one supplied in the command. Take the following for example: git merge –no-ff -m “Released v1.1.0.1 to master.” v1.1.0.1 I believe […]

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