[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: restricting git commits to the debian subdirectory?



On 06/23/2010 05:16 PM, Eric Cooper wrote:
I maintain both the upstream and Debian version of a program in a git
repo, using "upstream" and "master" branches, git-buildpackage, etc.

Occasionally I forget which branch I'm on and commit upstream changes
to the master branch by mistake.

Is there a way to tell git that when I'm on the master branch, I
should only be allowed to commit files in the debian/ subdirectory?


Perhaps a .gitignore file of something like:

*
!debian/

and maybe a bright red git branch listed on your $PS1, maybe:

mshuler@gaea:~$ cd src/repos/git/haproxy/
(master)mshuler@gaea:~/src/repos/git/haproxy$ grep -iC3 git ~/.bashrc
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
# adapted from http://people.planetpostgresql.org/dfetter/index.php?/archives/53-Git-+-bash-win.html
    if [ -f /etc/bash_completion.d/git ]; then
        PSGIT='\[\033[01;31m\]$(__git_ps1 "(%s)")\[\033[00m\]'
        PS1="$PSGIT$PS1"
    fi
fi

--
Kind regards,
Michael


Reply to: