I have several git projects which I want to fetch everyday (in the morning for example) and checkout to the last commit (if there are no local changes of course) to the branch "origin/dev" (e.g. it may not be a master branch). So how to do this for all projects in the directory?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
If you are using a *nix/mac you could use the following bash script and create a cron job/launchdaemon task:
One way would be to (experiment in a separate local directory):
git submodule update --recursive --remote
: that will fetch and checkout the latest from origin/dev for each submodules.Note that the local repo in the directory act as a "parent repo" for those submodules, and is purely local: no need to push that repo. It is just there to benefit from the submodule tracking branch feature introduced in git 1.8.2+ (March 2013).
Your git project repos can ignore completely the fact they are submodules for the parent directory repo.
In one command, you trigger a fetch + checkout of the latest commits on
origin/dev
for all your git project repos.Might be late for the party but I wrote a tool for Windows and macOS to auto-fetch multiple repositories (and other features):