>>> "KK" == Konstantin Khomoutov <kos...@bswap.ru> writes:
> On Mon, Nov 29, 2021 at 05:44:51PM +0100, Uwe Brauer wrote: > [...] >> Ok, right, I see now that I left out that important part of information. >> It should have been >> >> 1. I created the copyright (and copy branch one of them was silly anyway) and >> >> 2. Added two commits into that branch(es), if I remember correctly one >> commit belonged to two branches (that is possible right?) > Well, yes and no - depends on how one looks. > In Git, a commit does not in any way records explicitly which branch it was > created "on" (and it's possible to record a commit which does not belong to > any branch even initially), and hence the fact of belonging to a branch is a [Snip]... > One way to achieve the situation you have got in with plain Git is: > git checkout master > git add ... > git commit ... > ^ repeat twice to create two unneeded commits > git branch copy > git branch copyright I see such an operation is impossible in mercurial a commit belongs to only one and only one branch. >> >> That is were I was (and still am) confused: I created these branches >> locally and >> then pushed, I thought they would then be in both places: in my local >> repository and in the remote server repository. > Now that makes me confused, too, because a sequence of commands I showed above > would make you end up with the three local branches, and the following "push > all" command would create remote branches origin/copy and origin/copyright > (and update origin/master). > Sure, there was a way to create only remote branches w/o creating local - > say, by pushing like > git push origin HEAD:master HEAD:refs/heads/copy HEAD:refs/heads/copyright > but I doubt you'd do that in your right mind :-) > I think it's simpler to assume you have somehow managed to delete those two > extraneous local branches but forgot about that. Not sure we can find out > unless you have a history of the shell commands run (and that was a CLI tool - > which were used for deletion). I found out what happened. I owe you an apology, but on the bright side, I learned a ton new things about git. As I said I am one of the maintainer of matlab-mode(emacs), a git repository in sourceforge. Since I know mercurial relatively well but don't really understand git (to put it mildly). I am using the the hg-git plugin, that allows me to do all the commits merging etc in mercurial and then push to git. I am usually quite careful and have put several safety layers, a git sandbox at bitbucket to which I push first and a local git repository I also push first, check things and then push them to sourceforge. I was testing things and by mistake pushed directly an unwanted branch to sourceforge. In mercurial I would now be doomed. I mean I can revert these changes by an operation called «backout» but the bad commits would still stay on the server. This is why bitbucket allowed you to delete these commits using there server API. I vaguely remembered that git is less strict in this sense. So I pulled the commits in sourceforge to my local repository and wanted to clean up things. It never occurred to me, that there would be two type of branches (in mercurial there is only one type of branch, it commits can be on remote or on local or on both but there is no need to distinguish both). Yes I know git branch -a shows branches, I never really understand them all. I only realize by now that git does make a difference and as I must add, the wording of those is chosen, well poorly I would say. In any case these pushing and pulling explains the confusion I also caused. To summarize * master refers to the master branch on my local machine while remotes/origin/HEAD -> origin/master remotes/origin/master Remotes/origin/master Means the master on the remote server. Firstly I think * local/master Would be clearer but what I find really confusing is the use of the word origin in remotes!!! It should be remotes/HEAD -> remotes/master remotes/master (If I were not so scared I would be thinking of changing this configuration) Rationale. If I start create a repository, commit commit and finally push it to say new bitbucket repository then origin for me would be my local repository where things started. Anyway I do understand that this distinction exists, (still don't see why) but it is important to know Thanks and regards Uwe -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/87bl20vdbk.fsf_-_%40mat.ucm.es.
smime.p7s
Description: S/MIME cryptographic signature