branch

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

微笑、不失礼 提交于 2019-12-03 10:32:40
问题 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

【Git 第6课】 文件状态

随声附和 提交于 2019-12-03 10:26:52
在第4课的最后,我们用以下两条命令: git add readme.txt git commit -m 'my first commit' 向我们新建的git仓库中添加了对readme.txt文件的版本控制。现在,我们要试图对仓库中的文件进行一些改动,同时观察它们的状态变化,以此实践上节课中说的git工作流。 首先,在命令行的本地仓库工作目录下执行命令: git status 你会看到: # On branch master nothing to commit (working directory clean) 很好,你的目录是干净的,没什么可提交的。说明所有的文件都是未修改的状态,没有未跟踪的文件,也没有修改过未提交的文件。输出的提示还告诉你,目前在branch master上。关于branch的概念我们将在后面的课程中介绍。 接下来,随便用一个文本编辑器去修改一下readme.txt里的文字。另外,再向目录中新建一个test.py文件(也可以从别处copy一个过来)。 再次执行: git status 得到输出: # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout

git: error: src refspec master does not match any [duplicate]

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: src refspec master does not match any when pushing commits in git 49 answers After cloning git repository to directory "hggit" and setting the remote origin with mbm:hggit my name$ git remote add origin git@code.getpantheon.com:"mystringhere" After editing files I committed the changes (while located in a sub-dir) with mbm:handelgroup michaelmausler$ git commit -m "first commit" [master 5a29bc8] first commit 1 files changed, 2 insertions(+), 2 deletions(-) I then attempted to push file changes and

How do I find common files changed between git branches?

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an upstream repository with some changes. I have local changes I want to rebase onto the upstream changes. I want to know what files I've changed locally have also changed upstream so I can check any automatic merging. Alternatively, I'd like to manually do any merges during the rebase. 回答1: Expanded a bit: for you first part of the question, make a new branch, automatically do the rebase there, and then compare to your working copy. git branch workBranch git commit #throw your locals into your own branch for a brief moment git branch

What does this do: git branch -f

不想你离开。 提交于 2019-12-03 10:21:01
I'm trying to figure out how to use this command properly. I believe this is the command and flag I want to essentially make one branch into my other branch (basically delete a branch and create a new branch with the same name with the files of another branch), but I don't know for sure, or if I have the syntax correct. If I do this: git branch -f master sub-branch Will it remove all of the files from master and fill it with the files from sub-branch? Titas The -f argument stands for --force . If a branch called master already exists, git will not allow you to overwrite it, unless you use -f .

Git: temporarily reverting pushed commit(s)

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Say, you've pushed some commits and pulled them into production, in your server's webroot, for example. And then something goes wrong. Clearly, most often what you want to do is temporarily revert the files in the webroot to some previous state, then go back to your local development place, fix what is broken, test it, commit on top of commits that broke something and push these new fixing commits to the master branch. And then just go to the production webroot again and pull everything to the latest commit so everything is fixed

Git学习教程

浪尽此生 提交于 2019-12-03 09:56:37
Git 是一个 分布式的 文件版本控制系统,每个电脑都有一个 完整的 文件库和版本库,文件库之间可以互相推送和抓取版本信息。CVS和SVN是 集中式的 文件版本控制系统,文件库和版本信息集中存放在服务器上,每个电脑只跟服务器交互信息。 1. Git的安装 操作系统:Ubuntu 12.04LTS Git的安装命令: sudo apt-get install git 2. Git的配置 2.1. 设置Git的配置 --local option: read and write from .git/config 配置信息的作用域为当前库,配置信息存放在.git/config。 --global option: read and write from ~/.gitconfig. 配置信息的作用域为当前用户,配置信息存放在~/.gitconfig。 --system option: read and write from /etc/gitconfig, that contains value for every user. 配置信息的作用域为整个系统的所有用户,配置信息存放在/etc/gitconfig。 2.1.1 设置用户名 git config --global user.name "user name" 2.1.2 设置用户的邮箱 git config --global user

Remove experimental branch

巧了我就是萌 提交于 2019-12-03 09:55:11
How do I remove a feature branch in mercurial if I want to remove it completely? It should be stripped from the history and I don't want to merge the changes in another branch (just throw the code away). I know that I can clone my other branches to a new repository like described here but that does not seem to be a clean solution. schlamar I found a working solution here . It works by using hg strip from the mq extension: $ hg strip my_pruned_branch As mentioned in the comments, this should only be used for unpublished changesets. 来源: https://stackoverflow.com/questions/11084802/remove

Why isn't 'git bisect' branch aware?

余生颓废 提交于 2019-12-03 09:53:57
I'm trying to find the source of a bug that's come up since a commit in the past day on a long lived branch (which will be released much much later) called feature-x . There's a bug though. I find behavior that I don't expect from my script which might have been introduced in any of the commit's up till now, specifically because features of master are used heavily in feature-x, but less so on Master itself. To test this behavior, I have to run my script, dependent.pl. But when bisect jumps half way down the code, my script doesn't exist on Master and so it's impossible to test. I believe this

What is the easiest/fastest way to find out when a git branch was created?

有些话、适合烂在心里 提交于 2019-12-03 09:53:28
问题 I was trying to find out when a certain feature branch in one of my repositories was created and I found that surprisingly hard. I ended up using a combination of git show-branch and git log . Is there any easier way to find this little piece of information quickly and efficiently from the command line? 回答1: git show $(git merge-base master your-branch) will show the commit where your branch branched off master 来源: https://stackoverflow.com/questions/1808557/what-is-the-easiest-fastest-way-to