git-remote

Git submodule to track remote branch

核能气质少年 提交于 2019-11-27 04:49:57
I'm trying to use git submodules for aggregating 10+ repositories into one structure for easy development. It is supposed to clone the module and checkout a branch. Instead, the module is checked out in detached head mode. git clone git@github.com:org/global-repository.git git submodule update —init cd config-framework git status $git status #HEAD detached at b932ab5 nothing to commit, working directory clean gitmodules files seems to be okay $cat .gitmodules [submodule "config-framework"] path = config-framework url = git@github.com:org/config-framework.git branch = MY_BRANCH We want the MY

What is the difference between git push origin and git push origin master

試著忘記壹切 提交于 2019-11-27 03:55:29
Is there any difference in pushing the master branch of a local git repository to the master branch of a remote repository called origin with git push origin master or with git push origin ? The default action of git push and git push origin has changed since git version 1.7.11 : Before 1.7.11 , git push by default pushes all branches that also exist remotely with the same name. Since 1.7.11 , git push by default pushes the current branch to a remote branch with the same name. Before and after version 1.7.11 , the default behavior can be configured with the push.default configuration option.

Understanding .git/config's 'remote' and 'branch' sections

£可爱£侵袭症+ 提交于 2019-11-27 02:29:41
问题 Here's the contents of the remote and branch sections of my .git/config file. [remote "origin"] url = https://EvanAad@bitbucket.org/EvanAad/bitbucketstationlocations.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master What is the meaning and purpose of the contents of these sections, in particular the fetch and merge subsections? How is this information used by Git to guide its operation? 回答1: Its called refspec. Its the mechmism that

How do I move my remote git repo to another remote git repo?

只谈情不闲聊 提交于 2019-11-27 01:59:03
问题 I want to move my remote git repository and all its branches to a new remote repository. old remote = git@github.com:thunderrabbit/thunderrabbit.github.com.git new remote = git@newhub.example.net:tr/tr.newrepo.git 回答1: So what none of these other answers explains too well is that if you want to move all of your remote repository's branches to a new remote using Git's push mechanism, then you need local branch versions of each of your remote's branches. You can use git branch to create local

Git - Checkout a remote tag when two remotes have the same tag name

一个人想着一个人 提交于 2019-11-26 23:52:40
I had hoped this would work: git checkout remote/tag_name but it doesn't. This does: git checkout tags/tag_name but I'm doing something weird where I have a lot of remotes, and I'm worried about what happens if two remotes have the same tag. Is there a way to specify the remote when checking out the tag? torek Executive summary: what you want to achieve is possible, but first you must invent remote tags. You do this with a series of refspecs, one for each remote. The rest of this is about what these are, how they work, and so on. Your question asks about checking out a "remote tag", but Git

How to add a local repo and treat it as a remote repo

微笑、不失礼 提交于 2019-11-26 23:22:29
I'm trying to make a local repo act as a remote with the name bak for another local repo on my PC, using the following: git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak which gives this error: fatal: '/home/sas/dev/apps/smx/repo/bak/ontologybackend/.git' is not a valid remote name I'm trying to sync two local repos, with one configured as a remote named bak for the other, and then issuing git pull bak . What is the best way to do it? Edit: Sorry, silly me, I've just realized the remote add should be: git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git

Remote origin already exists on 'git push' to a new repository

a 夏天 提交于 2019-11-26 21:12:30
I have my project on GitHub at some location, git@github.com:myname/oldrep.git . Now I want to push all my code to a new repository at some other location, git@github.com:newname/newrep.git . I used the command: git remote add origin git@github.com:myname/oldrep.git but I am receiving this: fatal: remote origin already exists. You are getting this error because "origin" is not available. "origin" is a convention not part of the command. "origin" is the local name of the remote repository. For example you could also write: git remote add myorigin git@github.com:myname/oldrep.git git remote add

How to remove remote origin from Git repo

时光毁灭记忆、已成空白 提交于 2019-11-26 21:12:13
I just did git init to initialize my folder as git repo and then added a remote repository using git remote add origin url . Now I want to remove this git remote add origin and add a new repository git remote add origin new-url . How can I do it? kahowell Instead of removing and re-adding, you can do this: git remote set-url origin git://new.url.here See this question: Change the URI (URL) for a remote Git repository 1615903 If you insist on deleting it: git remote remove origin Or if you have Git version 1.7.10 or older git remote rm origin But kahowell's answer is better. Vontei To remove a

What are the differences between local branch, local tracking branch, remote branch and remote tracking branch?

若如初见. 提交于 2019-11-26 19:17:16
I just started using Git and I got really confused between different branches. Can anyone help me to figure out what the following branch types are? local branches local tracking branches remote branches remote tracking branches What is the difference between them? And how do they work with each other? A quick demo code will be really helpful I guess. SNce A local branch is a branch that only you (the local user) can see. It exists only on your local machine. git branch myNewBranch # Create local branch named "myNewBranch" A remote branch is a branch on a remote location (in most cases origin

Git branching: master vs. origin/master vs. remotes/origin/master

梦想与她 提交于 2019-11-26 15:36:34
I think I'm on the right track to understand the basic concepts of git. I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it. My problem is that I don't understand the difference between: origin/master vs. remotes/origin/master As far as I have understood, master is a local branch, and remotes/origin/master is a remote one. But what exactly is origin/master ? Take a clone of a remote repository and run git branch -a (to show all the branches git knows about). It will probably look something like this: * master