-
Notifications
You must be signed in to change notification settings - Fork 11
Git Tips
The "gitbatch.sh":http://github.com/dmzdev/scripts/blob/master/gitbatch.sh script provides the ability manipulate multiple DMZ git repositories simultaneously. The gitbatch.sh script takes the same commands as git, but runs the command in each repository. Instead of updating each repository individually as such:
% cd dmz
% git pull
% cd ../cycles
% git pull
% cd ../io
% git pull
etc...
All of the repositories can be updated at once:
% gitbatch.sh pull
The gitbatch.sh script may be called anywhere with in an DMZ source tree. If it is invoked outside of a DMZ source tree, it will try to find the git repositories in $HOME/cm/src.
The following are some helpful alias shortcuts that may be placed in .bash_profile or .bashrc:
export GITSCRIPTS=$HOME/cm/src/scripts # Location of DMZ Scripts
alias gbatch='$GITSCRIPTS/gitbatch.sh'
alias gpull='$GITSCRIPTS/gitbatch.sh pull'
alias gpush='$GITSCRIPTS/gitbatch.sh push'
alias gstatus='$GITSCRIPTS/gitbatch.sh status'
The gitremote.sh script provides the ability to add remote repositories. Once these remote repositories have been added they may be fetched and merged with your master or any other branch in your repository. To add dmzdev as a remote repository:
% cd ~/cm
% gitremote.sh dmzdev
Once dmzdev has been added as a remote repository, it can be fetched and merged with you local repository as follows:
% cd ~/cm
% gitbatch.sh fetch dmzdev
% gitbatch.sh merge dmzdev/master
The gitremote.sh script has a second optional parameter which allows the server to be specified. For example:
% cd ~/cm
% gitremote.sh dmzdev git://github.com/
This will use the git protocol instead of http when fetching remote repositories. The default server is http://github.com. The trailing slash is required when specifying a git or http server.