Git: How to avoid merging / fetching a wrong remote in a branch?
Say that I'm on my feature branch XXXX and issuing a
git pull bad_remote master here is a BAD thing to do (in the way our workflow and branches are set up, of course).
Is there a way to tell git (or via some Bash magic) to NOT EVER merge or fetch from that remote if you're not in a local branch named YYYY (the branch that is supposed to receive the bad_remote changes)? Having it spitting to me some bad words would a nice feature :)
I know how to solve the problem as soon as it happens, but if that happens and I'm not immediately aware of that... well... cherry-pick is my friend :(
Looking at hooks seems that the pre-merge is (still?) missing.
To begin with, I'm pretty new to Git. I have a default branch called master in my repo, I've created a new branch called bugs and added a known_bugs.txt file to it. The problem is that not only does
I made a git branch unintentionally named 0.2 which is also a tag. So I tried to remove it from origin: $ git branch -rD origin/0.2 Deleted remote branch origin/0.2 But then: $ git fetch origin * [
I've been using a git branch with a remote repo as well (Bit bucket) I decided to create a new branch so ran this code Directory= ~/tmp/merge/aaa> git branch iOSUI/beta Directory= ~/tmp/merge/aaa&g
I am trying to keep a feature branch up to date by merging trunk into the branch. Problem is, that about 2000 files that was there when the branch was created, and that has been left untouched on both
Added a new Branch to my Github, but can't find a way to have my local repo know about it. I have my local repo using the master branch (the only one it knows about), and it is several commits ahead
This is probably a dumb question, but I'm brand new to git and am seeing a remote branch that no longer exists. $ git branch -a * master remotes/origin/master remotes/origin/production I don't believ
I do not want to upload my app to the wrong domain. How can I change the git master branch on git?
I have created remote branch name REMOTE1 and made changes and updated the REMOTE1. Similarly my colleagues have worked on MASTER and made considerable amount of changes. Now I have to merge the chang
I am on a repo on github. I have one local branch called : master and on the remote repo there are two branches, branch1 and branch2. I cloned the repo from the branch1. But then, I wanted to pull bra
I've accidentally unhitched my master branch from tracking origin master I think. It used to be that I could run git pull and git push and it would know that I meant git push origin master but now it
Is it possible to pull from a remote repository but only selectively take files from that remote that I'm interested in? I don't want to simply pull down the entire branch. Thanks.
Twice now in git, I've meant to branch from master, but instead branched from my current branch by accident. This means that my pull request from the second branch included all of the commits in the f
I have a master branch and a es branch. es has been reconstructed locally: git checkout master git checkout -b es2 git cherry-pick A C E D git branch -D es git checkout master git branch -m es2 es wh
Is there a command (something like git remote show maybe) that will get me an up to date remote branch commit hash without updating references by fetching?
The git branch -a command gives me following output: master stable remotes/origin/master remotes/origin/restoring_entered_information_from_post remotes/origin/stable but there is no such a branch res
What does the branch parameter mean when issuing git fetch <remote_repo> <branch> ?
How can I create a new branch and push it to the remote and then share it with the other developers? I'm following the below steps. What's wrong, missing? Developer A creates the following: git branch
I have a remote and a local git repository. Local repository is clone from the remote. When I modify my local repository and commit to the master branch. Then I run git push to remote repository. Bu
I'd like a command that emits the name of the tracked branch for the branch I'm on. Something like: $ git checkout --track -b topic origin/master Branch topic set up to track remote branch master from
I am attempting to figure out which remote branch was most recently updated. Something like 'git show-ref' but in chronological order would be good enough. How do I go about doing this?
Lets say for the sake of argument that we don't care much about history. If I have a master branch that is being updated somewhat often and I have a shared topic branch that is rather long lived, will
Some contributors in our project likes to work on master directly and still forget to git pull --rebase. Is there a way to refuse on the server side commit with commit like Merge branch 'master' of .
git branch -a shows me all the branches PROVIDED I already have cloned the branch. For example if I have a remote branch that I have cloned, executing this from the base dir gives me this * master rem
I wish to set my master branch to the exact state that my tmp branch is at. There is incorrect changes committed on the master branch, but even after merging the tmp branch those mistakes still persis
I want to merge two remote repositories in Git. One is mainstream repository, which I do not have write permission. I want to track its master branch. The other is maintained by us, I have full right
I read 'http://gitready.com/intermediate/2009/02/13/list-remote-branches.html' . I am using git 184.108.40.206. My question is how can I check out a local branch which track a remote branch 'origin/2-2-stabl
I am trying to maintain a bare copy of a Git repository and having some issues keeping the remote tracking branches up to date. I create the remote tracking branches like this: git branch -t 0.1 origi
I am trying to figure out what branch will be fetched if I do git fetch in the current branch, and how can I change that (by some variant of git remote or editing .git/config file). From what remote
Such as, I have deleted the patch-1 branch in github.com, and run git fetch origin to update local repo to track the remote, but the command git branch -a still show I local repo tracking remotes/orig
I am wondering what happens if I create a branch in git that have the same name as a remote branch. Would the first branch stop to exist in the remote repository once I push my branch? For example, le
Wow, I'm having a heck of a time with git. Here is my situation. Master -- all fine in good. Most recent code in production. iss454 -- Originally pulled down remotely. Then I somehow merged master in
I'm in master and I do a git pull, I get a message indicating I need to pull a remote branch. Typically I do a git co [branch] then git pull/rebase. Is there a way to git pull/rebase of [branch] witho
I tried creating remote branch devel using: git push origin origin:refs/heads/devel But it fails with: error: src refspec devel does not match any. error: failed to push some refs to 'git@***.com:**
I have a remote project that have a branch. So I first clone the repo. Then issue the following to the clone to work on a branch: git checkout -b <name> <remote_branch_name> Then I made t
I have the following remotes set up: $ git remote korg rorg And the following branches: $ git branch -a * (no branch) remotes/korg/gingerbread remotes/korg/gingerbread-release remotes/korg/honeycomb
I have remote origin with branches a, b and local branch a. I have finished working on local-a, and pushed it to remote-a. I now want to create a local branch b-myUserName based on remote b. How do I
I usually create new branch from develop git checkout -b new-feature develop then after the last commit I merge back to develop git checkout develop git merge new-feature but this time I created new
I've got an Xcode project under git and I've got a experimental branch off of my master branch. Both branches have diverged since the branch (so no fast-forwarding!), and I am merging experimenta
Can someone show me how to compare a local branch with remote branch to see the all the differences or new changesets added? I only want to see what's new like hg incoming or hg outgoing. I don't want
I'm using git-svn to interact with a remote svn repsitory that follows the traditional layout of trunk, tags, and branches. There's a branch in svn that git has missed the history of. I know the histo
Quick sanity check - I wanted to create a new remote branch for myself. I want to do the following: git clone firstname.lastname@example.org:orange/orange.git git branch foo git checkout foo git push foo foo I'd lik
How can I merge a state before wrong commits into the current head in Git? Mistakenly merge by a other person resetted my change on the server, after I fetched and merged the remote master branch, my
Just wondering what is the usual practice for merging back to the master, when the HEAD is likely to have been updated again since the last pull before the merge. To illustrate, in the following diagr
I am trying to clone a repo from an SSH remote like this: git clone ssh://email@example.com/var/www/git/www This works OK but using this command I am actually cloning the master branch of
I fetch a remote branch via git fetch origin name-of-branch:refs/remotes/name-of-branch. I use git checkout name-of-branch I am put in a detached head state. I can get to a named branch now by using g
One time, I accidentally pushed a commit to the remote repository with the wrong author email. I used git filter-branch -f --env-filter GIT_AUTHOR_NAME='Niklas Rosenstein'; GIT_AUTHOR_EMAIL='<<
This is remote Git repository on server [aaa@web48 proj.git]$ git ls-remote . dfca707432eb53678b37026b160a4bdc7f1ac6c3 HEAD dfca707432eb53678b37026b160a4bdc7f1ac6c3 refs/heads/master 1e09c37443ee75864
In git, I named a branch: parse() The name has been accepted, but when merging I get the error: git merge parse() bash: syntax error near unexpected token '(' Is it possible to rename a branch? Are
When I want to delete a branch locally on git and propagate this to the GitHub repo, I use this 2-step method: ~$ git branch -d [branch_name] ~$ git push origin :[branch_name] Is there any command to
If you have a branch which you forked off of master and then developed your feature in it...when it comes to merging back into master, I've heard 2 different approaches: First merge master into the f