I am working with Git repositories in the following way:
I am about to switch from Git to Mercurial and I would like to know ahead how I can achieve something like that.
Adding a remote repository To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. The git remote add command takes two arguments: A remote name, for example, origin.
You can list the remote branches associated with a repository using the git branch -r, the git branch -a command or the git remote show command. To see local branches, use the git branch command. The git branch command lets you see a list of all the branches stored in your local version of a repository.
You can set multiple remote URLs to a single remote using git remote. If you don't have a remote named 'all' already, create it using git remote add then use git remote set-url –add to add a new URL to the existing remote. You can cross-check added new remotes using git remote -v .
You add entries to the [paths]
section of your local clone's .hg/hgrc
file. Here's an example of a section that would go in the .hg/hgrc
file:
[paths] remote1 = http://path/to/remote1 remote2 = http://path/to/remote2
You can then use commands like hg push remote1
to send changesets to that repo. If you want that remote repo to update is working directory you'd need to put a changegroup
hook in place at that remote location that does an update. That would look something like:
[hooks] changegroup = hg update 2>&1 > /dev/null && path/to/script/restart-server.sh
Not everyone is a big fan of having remote repos automatically update their working directories on push, and it's certainly not the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With