![]() When right-clicking a branch, you can select to Set Upstream. My question is, is there any way to set a different remote repository And if I make any changes, I can push my fork at origin/develop and create a pull request there to merge to upstream/develop if the changes are approved.Īlso, in in Gitkraken if I right click upstream/develop there is an option to merge upstream/develop into develop that should take the most recent changes in upstream/develop and merge it into my local copy right? (God help me if suddenly I'm merging my local develop to upstream). So if people make changes to the original repository, it'll show up in my Sourcetree and I'll know to pull from upstream/develop to local/develop. And if that isn't possible, is there a way to track a different remote branch from the one you are pushing/pulling from?įor example Sourcetree is set up so that local/develop tracks the remote branch upstream/develop, while pushing to the remote branch origin/develop. push to origin/develop pull from upstream/develop using the buttons on the top menubar). My question is, is there any way to set a different remote repository in Gitkraken for pushes and pulls? (E.g. I've recently found an Ubuntu machine to develop on, and having found that Sourcetree isn't available for Ubuntu, found Gitkraken as a potential alternative. Therefore, if you want them to have the exact same history, you'll need to fix your commits locally to make them acceptable by both remotes and push again, or you might end up in a situation where you can only fix it by rewriting history (using push -f), and that could cause problems for people that have already pulled your previous changes from the repo.I've been working on a Mac using Sourcetree to manage my repositories. IMPORTANT NOTE: If your remotes have distinct rules (hooks) to accept/reject a push, one remote may accept it while the other doesn't. Now a single git push all master will push the master branch to both git://another/repo.git and git://original/repo.git. Now let's add another pushurl pointing to the original repository: $ git remote set-url -add -push all git://original/repo.git This shows how pushurl overrides the default url (). Here git remote -v shows the new pushurl for push, so if you do git push all master, it will push the master branch to git://another/repo.git only. Then let's add a pushurl to the all remote, pointing to another repository: $ git remote set-url -add -push all git://another/repo.gitĪll git://another/repo.git (push) <- CHANGED =+refs/heads/*:refs/remotes/all/* <- ADDED So let's add a new remote called all that we'll reference later when pushing to multiple repositories: $ git remote add all git://original/repo.gitĪll git://original/repo.git (fetch) <- ADDEDĪll git://original/repo.git (push) <- ADDED If you still want to use origin, skip the following step, and use origin instead of all in all other steps. Now, if you want to push to two or more repositories using a single command, you may create a new remote named all (as suggested by Nelson in comments), or keep using the origin, though the latter name is less descriptive for this purpose. ![]() You can verify this behavior below: $ git clone git://original/repo.git ![]() However, you may add multiple pushurls for a given remote, which then allows you to push to multiple remotes using a single git push. ![]() Doing git remote set-url -add -push adds a pushurl for a given remote, which overrides the default URL for pushes. Hamano, the Git maintainer, explained it's how it was designed. Doing git remote -v should reveal the current URLs for each remote. UPDATE 1: Git 1.8.0.1 and 1.8.1 (and possibly other versions) seem to have a bug that causes -add to replace the original URL the first time you use it, so you need to re-add the original URL using the same command. So when you push to origin, it will push to both repositories. Git remote set-url -add -push origin git://another/repo.git Use the following to add two pushurls to your origin: git remote set-url -add -push origin git://original/repo.git In recent versions of Git you can add multiple pushurls for a given remote.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |