Tag: bash

finding out the last modified time of all modified files in git

If I do git status I see a bunch of changed files and a few new ones as well. I’d like to be able to see the last modified time of each of these files (and from there see which one is the oldest / newest) but it is not clear to me how to […]

Can pre-receive hook edit commits?

I’m building a pre-receive hook to check the name and email address of the author. I’m able to easily check if the name/email address of the commit using, while read oldsha newsha refname; do authorEmail=$(git log -1 –pretty=format:%ae $newsha) if [[ $(grep -w $authorEmail ~/.ssh/authorized_keys | wc -w) -gt 1 ]]; then echo “Author Email: […]

Cloning a GIT branch to another repositories GIT branch?

I have two GIT repositories, one for work and one for independent development. My company expressed interest in a project I’ve been working on and would like me to migrate that branch (master) into a new branch on their repo (Features/Dynamo). I have created a migrator in the past but this clobbers the repo being […]

How to automate symlink script

Everyone knows you cannot commit anything in .git/hooks because it’s not a git repository. So I wrote a script to symlink all hooks in .git/hooks to point to all of my hooks located in my_repo/hooks/driver. Now I can track and commit my hooks, as I please. This was recommended by several stack overflow users across […]

git verify-pack and number of blobs

I am looking at this line: # list all objects including their size, sort by size, take top 10 objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head` It says that 10 items will be taken. But I don’t see 10 anywhere. What if I want 40 instead, where should that […]

Git Post Merge Hook does not recognize valid commands

Here is my post-merge hook script. Trying to do some cleanup/setup on post merge based on the currentBranch. Not getting the output i expect # !/bin/bash git branch –contains $2 curbranch1=$(git branch –contains $2) echo $curbranch1 curbranch2=$(echo “$curbranch1″|grep “*”) echo $curbranch2 #output Switched to branch ‘develop’ * develop NET SRC-Fiery-PF-PS VB6Dev bin develop NET SRC-Fiery-PF-PS […]

Command for viewing overall git status regardless of location in directory

Is there a way to see a big-picture status in git? I’m new to git and end up losing files based on stashing them in the wrong directory or working on the wrong branch, and I’d like to find a command that gives me an overview of everything, regardless of where in the directory I […]

Searching for a string in a git repository, across all branches/commits/stashes/etc

I’ve got a git repository which is a total mess of branches, commits, and stashes. What I want to do is to search and extract all files containing a given string. The search should cover all previous versions of all files that ever existed in any shape or form in the repository, and should return […]

Renaming several git branches

I am switching over to GitHub from a different git provider. I pulled all branches to my local with for remote in `git branch -r`; do git branch –track $remote; done but instead of getting branch named name I got them named origin/name so now I need to rename them to be just name. Any […]

bundle install from a new server errors due to git ssh key

I am installing a new server via chef and coping ssh private and public keys into it. After creating it , I am deploying the application onto it via jenkins and running bundle install. it fails due to Host key verification failed. fatal: The remote end hung up unexpectedly If i ssh into the server […]

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