Last active
September 27, 2017 10:41
-
-
Save zamuro/63a562f3cc49fc0b7980395fe6a13b2e to your computer and use it in GitHub Desktop.
Configuration for automated pull for consul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
[remote "origin"] | |
url = git@github.com:[user or organization of your fork]/consul.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
[branch "master"] | |
remote = origin | |
merge = refs/heads/master | |
[remote "consul"] | |
url = https://github.com/consul/consul.git | |
fetch = +refs/heads/*:refs/remotes/consul/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# m h dom mon dow command | |
15 9 * * 1-5 sh ~/.update_consul |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
consul_path="Here comes your consul path" | |
cd $consul_path | |
get_current_branch(){ | |
current_branch='git rev-parse --abbrev-ref HEAD' | |
echo_current_branch=$current_branch | |
stored_branch=`echo $current_branch` | |
$stored_branch | |
} | |
this_branch=`get_current_branch` | |
old_branch=`echo $this_branch` | |
git checkout master | |
git pull | |
git pull consul master | |
git push origin master | |
git checkout $old_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update_consul is the bash file that synchronizes both consul/consul and your local fork. It is strongly recommended that you automate this via consul_cron either adding it to cron.daily or via crontab -e
.gitconfig actually .git/config in your local area path. Only needed change is url parameter in section origin. Everything else is there for context purposes.