Wondering if Mercurial while cloning the repo includes all remote branches as well? Basically I have some proprietary / not used mercurial repository with many branches. I want to clone all of them at once and make backup out of it.
If you clone a mercurial repo without any additional arguments, you make a copy of a repository this includes all branches.
https://www.mercurial-scm.org/repo/hg/help/clone :
hg clone [OPTION]... SOURCE [DEST]
make a copy of an existing repository
Create a copy of an existing repository in a new directory.
Related
I have files for a website in a folder on my computer that I'd like to put on GitHub. Do I create a repository in GitHub Desktop first or create a repository on GitHub first? And once I have a repository what is the very first thing I do to move those files into the repository? This may be a stupid question but I've made a mess of things and I'm very confused at this point.
Create a repository on GitHub
git clone your new repository on your computer
Copy the files you want to push to your repository inside the new folder created by cloning
git add --all to add all these files for commit
git commit -m "Initial commit" to create a commit
git push to push this commit to your GitHub repository
I just migrated an old project from an own Subversion/Trac infrastructure to GitHub
https://github.com/matteocorti/nagios_plugins
The repository contains one directory for each plugin I wrote. Each plugin is standalone and has an own version number (but the source code is in the same repository).
When I release a new plugin version I would like to have a release with just the corresponding folder (e.g., https://github.com/matteocorti/nagios_plugins/tree/master/check_updates)
Is there a way with the GitHub release feature to select which part of a repository contains the software to be released?
Another option would be to split the whole and have a repository for each plugin. This would imply that I will have to manually move all the issues/bugs and wiki pages.
Edit
It seems that the only solution would be to split the repository (a separate repository for each plugin).
How can I split a Git repository retaining the commit history?
It seems that the only solution would be to split the repository (a separate repository for each plugin).
It is, but that does not migrate wiki pages and issues.
To split a git repo while keeping the history, see GitHub page "Splitting a subfolder out into a new repository"
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
git filter-branch --prune-empty --subdirectory-filter \
YOUR_FOLDER_NAME master
# Filter the master branch to your directory and remove empty commits
# Rewrite 48dc599c80e20527ed902928085e7861e6b3cbe6 (89/89)
# Ref 'refs/heads/master' was rewritten
The repository now contains all the files that were in your subfolder.
Note that although all of your previous files have been removed, they still exist within the Git history. You can now push your new local repository to a new repository on GitHub.
Check also "How to tear apart a repository: the Git way "
Once you have one repo per plugin, you can still register them in your original repo, as git submodules.
Edit
To push the subfolder to a new repository
git remote rename origin upstream
git remote add origin NEW_URL
git push origin master
I have a project in Eclipse that I want to put on github, so I went to github and created the repos for them, but I want to clone them right into the folder where the files are stored in my eclipse workspace. How can I do this?
EDIT: When I try it, the github app says it can't clone because the folder isn't empty.
EDIT 2: Will this work? Changing the name in eclipse to rename the project folder, then cloning the repo to the name I want, in the workspace, then renaming the eclipse project so they merge and I can commit the new files.
GitHub has a guide explaining how to put an existing project on GitHub.
You should not clone the repository, but add the GitHub repository as a remote to a local repository you create yourself.
Go to your project folder and initialize a local repository with git init
Add and commit all your project files to the local repository. (e.g. git add . and git commit -m "message")
Add the GitHub repository as a remote. git remote add origin *github repository URL* (Verify with git remote -v)
Push your project to GitHub with git push origin master.
If you already have committed files to the GitHub repository, it is still possible.
Initialize your local repository.
Add GitHub as the remote.
Pull from GitHub.
Add and commit your project.
Push you project to GitHub
First add the remote as follows
git remote add origin <GIT URL>
Then simply do the following (MAke sure to commit any of your local files)
git pull --allow-unrelated-histories
How can I migrate a private Bitbucket repository to a public Github repository?
Make a "bare" clone of the repository (i.e. a full copy of the data, but without a working directory for editing files) using the external clone URL. This ensures a clean, fresh export of all the old data.
Push the local cloned repository to GitHub using the "mirror" option, which ensures that all references (i.e. branches, tags, etc.) are copied to the imported repository.
Here are all the commands:
git clone --bare https://bitbucket.com/user/repo.git
cd repo.git
git push --mirror https://github.com/ghuser/repo.git
I'm seeing the command 'pull' and wondering how that's different from a 'clone'. Both terms seem to imply retrieving code from some remote repository. Is there some subtle distinction here?
Use clone when you need to make a new repository based on another. Use pull later to transfer new changesets into the clone. You cannot use clone to fetch just the newest changesets — that is what pull is for. The pull command will compare the two repositories, find the missing changesets in your repository and finally transfer those.
However, you are right that there are similarities between clone and pull: they both transfer history between repositories. If you clone first
hg clone https://www.mercurial-scm.org/repo/hg/
then this has the exact same effect as doing
hg init hg
cd hg
hg pull https://www.mercurial-scm.org/repo/hg/
hg update
You get the exact same history in both cases. The clone command is more convenient, though, since it also edits the .hg/hgrc file for you to setup the default path:
[paths]
default = https://www.mercurial-scm.org/repo/hg/
This is what lets you do hg pull in the repository without specifying a URL. Another advantage of using clone is when you work with repositories on the same disk: hg clone a b will be very fast and cheap in terms of disk space since b will share the history with a. This is done using hardlinks and works on all platforms (Windows, Linux, Mac).
hg clone is how you make a local copy of a remote repository. The Subversion equivalent is svn checkout.
hg pull pulls changes from another repository. hg update applies those changes to the local repository. hg pull -u is equivalent to hg pull; hg update. The Subversion equivalent to hg pull -u is svn update.
clone creates a new repository as a copy of an existing repository.
pull imports all changesets (not already present) from another repository into an existing repository.