could somebody explain me (or lead me to a good reference) the following issue?
I know that below is the correct push command that I have to use:
git push origin refs/heads/master:refs/heads/master
(I also know that it has short forms, like:
git push origin master:master
or
git push origin master)
However, once time, I did 2 following push (by mistake):
(1) git push origin refs/heads/master:refs/remotes/heads/master
(2) git push origin refs/heads/master:refs/remotes/origin/master
git report no error in both commands, although in (1), I have no remote name "heads".
My first question is: what does git push to the remote repository in these cases? Do they harm my remote repository?
The second question is: according to http://progit.org/book/ch9-3.html everything under "refs/remotes" is remote references which are to know the last commit ID on the corresponding remote branch at the last server comminication. Is it just for that (e.g. only for information), does any git command use these references?
Update with my findings about the command (2)
I carefully verified again the behavior of the command (2) by:
- backup the remote repository
- do the (2)
- compare the two repositories (the current one and the backup)
I found differences in the current one (the one effected by command (2))
- in "objects" folder, there are 2 new files created: one is .pack file and the other is .idx file
- in "refs" folder, a new refs was create "remotes/origins/master"
I noticed that the output of command (2) was
Counting objects: 842, done.
Compressing objects: 100% (337/337), done.
Writing objects: 100% (651/651), 336.30 KiB, done.
Total 651 (delta 243), reused 612 (delta 218)
To file:///data/resto/central-repo
* [new branch] master -> origin/master
Now I made another test:
- Clone the remote repo into 2 local repos
- In one local repo, I made change on a file, commit, push (git push origin master)
In the other local repo
- I made change on a file, commit
Push with git push origin master:master
I got an error message from git:
"...! [rejected] master -> master (non-fast-forward)..."
That what I expectThen I made a push with command (2) and the result was what I mention ealier above.
So it's obviously the (2) is different from git push origin master.
What is the meaning of "refs" folder in the remote
repository? The command (2) create a new "refs" in
the remote repositoty, what does it refer to?