Active
Project:
Quickstart: Prebuilt Drupal Development Environment
Component:
Contrib Scripts
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 May 2011 at 22:09 UTC
Updated:
11 Jul 2012 at 16:22 UTC
I have created 2 scripts to help me configure git. Thought others might find this useful.
This first script configures git bash completion.
#!/bin/bash
# README:
#
# This script will install git bash completion
#
cd ~/
git clone git://git.kernel.org/pub/scm/git/git.git
mv git/contrib/completion/git-completion.bash ~/.git-completion.sh
rm -rf ~/git
echo "export GIT_PS1_SHOWDIRTYSTATE=1" >> ~/.bashrc
echo "export GIT_PS1_SHOWSTASHSTATE=1" >> ~/.bashrc
echo "export GIT_PS1_SHOWUNTRACKEDFILES=1" >> ~/.bashrc
echo "source ~/.git-completion.sh" >> ~/.bashrc
# Add git info to PS1 (append this to your ~/.bashrc file, not commented)
#PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '
zenity --info --text="Add git info to PS1 (append this to your ~/.bashrc file)\n\nPS1='\\\[\\\033[32m\\\]\\\u@\\\h\\\[\\\033[00m\\\]:\\\[\\\033[34m\\\]\\\w\\\[\\\033[31m\\\]\$\(__git_ps1\)\\\[\\\033[00m\\\]\\\\$ ' "
The script clones git, copies the bash completion file to ~/ the deletes the repo. Then adds configuration to the .bashrc file. Finally it pops up a message that lets you copy the PS1 to paste into you .bashrc
This second script does some basic configuration.
It download some git applications: gitk, gitg and git-gui
Sets up git colors and prompts for user.name and user.email
#!/bin/bash
# README:
#
# This script will install gitk, git-gui, gitg, configure git status colors
# and user.name and email
#
sudo apt-get -yq install gitk git-gui gitg
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global color.status.changed yellow
git config --global color.status.added green
git config --global color.status.untracked red
# Set name and email in gitconfig
GITUSERNAME=`zenity --width=300 --entry --title="Configure git --global user.name" --text="Enter your name:"`
if [ "${GITUSERNAME}" != "" ]; then
git config --global user.name "$GITUSERNAME"
fi
GITEMAIL=`zenity --width=300 --entry --title="Configure git --global user.email" --text="Enter your email:"`
if [ "${GITEMAIL}" != "" ]; then
git config --global user.email "$GITEMAIL"
fi
git config --global --list
I can also provide these as patch files if wanted.
Comments
Comment #1
mike stewart commentedReviewing to consider how to integrate into Quickstart 2.0.
Comment #2
mike stewart commentedReally interesting stuff. Thanks for sharing. I'm going to combine a lot of this, with the new stuff I have already added to 7.x-2.x branch.
Comment #3
mike stewart commentedI'm removing assignment to me since I'm no longer maintaining the 7.x-2.x branch (its moved to DrupalPro Development Desktop), and I'm not sure of the future of Quickstart 2.x except that it wont be based on Ubuntu 12.04LTS (Unity)
Comment #4
MichaelCole commented