Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I mark a branch as 'not going to push'?

I use named branches in Mercurial.

In doing so I have created one branch called playground where I can try out various wacky experiments. I never intend to merge this branch into any others and I never want to push it to our main repository.

Since creating it, every time I do a push I am told I have added a new branch and I have to use the --new-branch flag. At this point hg push -b default (or whatever branch I'm pushing) works fine but it's annoying. Is there any way to suppress that message by letting Hg know that I am not interested in pushing that branch ever?

like image 518
George Mauer Avatar asked Jan 24 '12 23:01

George Mauer


People also ask

How do I stop a git branch from working?

Yes, just delete the branch by running git push origin :branchname . To fix a new issue later, branch off from master again. That will delete the remote branch, not the local one.

Does git push only push the current branch?

By default, git push only updates the corresponding branch on the remote. So, if you are checked out to the main branch when you execute git push , then only the main branch will be updated. It's always a good idea to use git status to see what branch you are on before pushing to the remote.

How do I push a new branch to a remote?

Push a new Git branch to a remote repoClone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.


1 Answers

Starting with Mercurial 2.1 (released in February 2012), you can mark your changesets secret to keep them from being pushed to another repository. You use the new hg phase command to do this:

$ hg phase --force --secret . 

This mark the current working directory parent revision (.) as being in the secret phase. Secret changesets are local to your repository: they wont be pushed or pulled. Pushing now looks like this:

$ hg push pushing to /home/mg/tmp/repo searching for changes no changes to push but 2 secret changesets 

There is no equivalent mechanism in older versions of Mercurial. There your best bet is to create a local clone for the changesets you don't want to push.

like image 149
Martin Geisler Avatar answered Sep 28 '22 07:09

Martin Geisler