I have a git repository with long and strange history. I don't know what the developers did with this repository and cannot control what they are doing with it now.
But I need to clone this repository (for redmine integration) and fetch all changes periodically.
What do I do:
git clone --bare [email protected]:/opt/git/repo
cd repo.git
git log
Now I can see all commits. Fine.
Next a developer make a commit in the main repository and I want to fetch all changes (all brances, tags and so on, and so on):
> git fetch --all
Fetching origin
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From git.gmcs.ru:/opt/git/ecco
* branch HEAD -> FETCH_HEAD
But if a ask the commit history I didn't see that last commit which was made in the main repository. Why ?
If I post not enough information I am ready to give you all the needed.
Thanks in advance.
Updated
Here is a brach information in the original repsitory:
git branch -a
one
test
* master
release
Here is a branch information in the cloned repository:
git branch -a
one
test
* master
release
I can see last commits in the master branch of original repository, but can not find them in the master branch of cloned repository.
In order to clone your repository to create a new bare repository, you run the clone command with the --bare option. By convention, bare repository directory names end with the suffix . git , like so: $ git clone --bare my_project my_project.
git clone --bare origin-url : You will get all of the tags copied, local branches master (HEAD) , next , pu , and maint , no remote tracking branches. That is, all branches are copied as is, and it's set up completely independent, with no expectation of fetching again.
git pull (or git fetch + git merge ) is how you update that local copy with new commits from the remote repository. git clone is used for just downloading exactly what is currently working on the remote server repository and saving it in your machine's folder where that project is placed.
On GitHub.com, navigate to the main page of the repository. Above the list of files, click Code. Click Open with GitHub Desktop to clone and open the repository with GitHub Desktop. Follow the prompts in GitHub Desktop to complete the clone.
To fetch more updates into a bare repo, I do:
git config remote.origin.fetch 'refs/heads/*:refs/heads/*'
Then I can do:
git fetch
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