A set of Git scripts to help developing and deploying.
Create configure file for Git
git config - f [fileName] [level1.level2.levelN] [value]
Include configure file in local config of Git
git config include.path filePath(if it is in the file path then filePath=../fileName)
You can set default routes
Some commands contain black and white lists or a default option for branches
Configure list black and white the remotes
git config remotes.list.white remote1,remote2,remoteN
git config remotes.list.black remote1,remote2,remoteN
Copy the bin folder to your home directory or the contents to any folder in PATH. If don't work do the following edit the .bashrc file and check it has the line:
PATH=$PATH:$HOME/bin
The scripts require the following packages:
realpath
You can install it with your system package manager. For example in Debian:
sudo apt-get install realpath
Execute:
./crearDeb.sh
sudo dpkg -i gitUtils.deb
Generates a file that shows the pending confirmation files of the current branch and a tar.gz that contains those files
git pusharchive
The command must be executed in the root of the git repository. The file is generated in the parent directory with the name:
[repository_name]-not-pushed-patch_[date].tar.gz
Another file with the list of changes is also generated with the name:
[repository_name]-not-pushed-files_[date].txt
This command is useful for viewing the current modified files affected by prepared commits
Generates a tar.gz with all changed files between current branch and destination branch. Before doing the file it updates all branches from origin.
git config diffarchive.route [route]
git diffarchive [destination branch] [destination folder]
[destination branch]
is the branch to diff from the current branch. master
is used by default
[destination folder]
is the folder where will write the file and the list of files included, by default is the parent folder.
$> git diffarchive master
The command must be executed in the root of the git repository. The file is generated in the parent directory with the name:
[repository_name]-[destination_branch]-[origin_branch]-patch_[date].tar.gz
Another file with the list of changes is also generated with the name:
[repository_name]-[destination_branch]-[origin_branch]-files_[date].txt
The command is usefull to gather all files needed to be uploaded to a remote server (production, development, etc) and upload it manually.
Fast forward every branch to be updated from their remote
git config updateall.list.black/white branch1,branch2,branchN
git config updateall.default branch1,branch2,branchN
$> git updateall
This command is usefull to update the entire local repository from the remote repositories
Pull all remote branches to the current one.
git config pullall.list.black/white branch1,branch2,branchN
git config pullall.default branch1,branch2,branchN
git pullall [origin branch]
[origin branch]
pull all the branches remotes to the current branch. By default are all branches
$> git pullall
$> git pullall my_branch my other_branch
This command is usefull when working with many developers in the same proyect with hight posibilities of collisions. A updated branch is very important in this cases.
This command is usefull to update your branch before a deploy using the diffarchive
command.
Push current branch to designed branchs in all origins
git config pushall.list.black/white branch1,branch2,branchN
git config pushall.default branch1,branch2,branchN
git pushall [destination branch]
[destination branch]
is the branch to push from the current branch. dev master
is used by default
$> git pushall
Push the current branch to all origin's branchs with name dev
or master
(default values)
$> git pushall my_branch my_other_branch
Push the current branch to all origin's branchs with name my_branch
or my_other_branch
This command is usefull to push your changes to multiple origins or/and to multiple branches
Create a tar file with all the files changed but not commited in the current branch or for a commit id.
git config changesarchive.route [route]
git changesarchive [commit id]
[commit id] is the commit id used to generate the archive with the changed files. If not commit id is set all uncommited changes will be used.
Generate a file with all uncommited changes
$> git changesarchive
Generate a file with all files changed in a commit
$> git changesarchive 4670ddc015
This command is usefull to get the current changed files or the files affected by a commit.