11/28/2023 0 Comments Gitkraken push all branches![]() But their Git, over on origin, still has a local branch named pu, so: $ git remote show originįetch URL: git:///pub/scm/git/git.git Now if I run git branch -r I will no longer have an origin/pu: my Git no longer has that as a remote-tracking branch. (Usually, for situations like this, they have only local branches.)įor illustration purposes, let me delete one of my own remote-tracking branches (this is pretty harmless since I will run git fetch in a moment to restore it): $ git branch -r -d origin/puĭeleted remote-tracking branch origin/pu (was 7c79844). They, too, may have local branches, and even remote-tracking branches, of their own. ![]() So you can look at your information, or you can ask your Git to call up their Git, over the Internet-phone, and query them about their information. Remember that there are two (or sometimes even more) Git version-control databases involved any time you fetch or push commits. ![]() git remote (sometimes) actually calls up the remote Git Means that my Git's origin/master is my Git's memory of what master meant, on origin, the last time had my Git call up origin and fetch-i.e., update-from them. Hence: $ git rev-parse -symbolic-full-name origin/master Note that feeding a remote-tracking branch name to git rev-parse also works, and you can get its symbolic-full-name as well: this simply begins with refs/remotes/, followed by the name of the remote, followed by the local name as seen if you're the Git running on the remote. It is possible for you to manipulate them yourself, but it's not profitable, as their intent is to remember some other Git's branch names (and corresponding SHA-1 values). The key difference between these is that your local branches are your names to manipulate however you like, while your remote-tracking branches are your names that Git automatically slaves to something else. These are what git branch -r shows: $ git branch -r The word "branch" often means one of these: a name that, when fed to git rev-parse, resolves to a commit ID: $ git rev-parse diff-merge-baseĪnd whose full name starts with refs/heads/: $ git rev-parse -symbolic-full-name diff-merge-base These are what git branch shows, when used with no arguments and flags. Let's back up a bit, and define two sets (or classes, or whatever word you like to group them) of branches. Git remote show origin shows me all branches. There are, in fact, three sets of branch names involved in this question. You do, however, have at least one small misconception built in to your question-which is not surprising this particular part of Git is tricky at first. It's not at all clear why you've been seeing remote-tracking branches without these flags (perhaps you have been using a GUI that shows them automatically?). I assume that you would have to do a git init -bare on the new location before pushing.TL DR: just use git branch -r or git branch -a (after git fetch to update). What I am interested in is whether a git clone -mirror from the original to your local workstation, followed by a git push -mirror to the new location is equivalent to doing an rsync -avz directly from the original location to the new location. ![]() I assume there may be some differences if the remote repo is a bare one as opposed to a regular workin repo. If from one location you execute a 'git push -mirror' to the remote, does the push virtually clone the local repo on the remote? By that I mean is it equivalent to deleting the remote repo, and executing an rsync -avz from your git repo to the remote? Does git virtually delete the original repo before pushing your own there - ie the repo will not combine your push with what was there before and not retain any information from the other users at all? Let us say you clone a repo to different locations and do different work on them.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |