branch

Git merge errors

半城伤御伤魂 提交于 2019-11-27 08:56:59
问题 I have a git branch called 9-sign-in-out with perfectly working code, and I want to turn it into the master. I'm currently on the master branch. $ git branch 9-sign-in-out * master I'm trying to switch to 9-sign-in-out branch, but it doesn't allow me to: $ git checkout 9-sign-in-out app/helpers/application_helper.rb: needs merge config/routes.rb: needs merge error: you need to resolve your current index first Any idea how can I ignore all the master branch errors and turn the 9-sign-in-out

Git 常用命令清单

倾然丶 夕夏残阳落幕 提交于 2019-11-27 08:26:43
一、新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [ project-name ] # 下载一个项目和它的整个代码历史 $ git clone [ url ] 二、配置 Git的设置文件为.gitconfig,它可以在用户主目录下(全局配置),也可以在项目目录下(项目配置)。 # 显示当前的Git配置 $ git config --list # 编辑Git配置文件 $ git config -e [ --global ] # 设置提交代码时的用户信息 $ git config [ --global ] user.name "[name]" $ git config [ --global ] user.email "[email address]" 三、增加/删除文件 # 添加指定文件到暂存区 $ git add [ file1 ] [ file2 ] .. . # 添加指定目录到暂存区,包括子目录 $ git add [ dir ] # 添加当前目录的所有文件到暂存区 $ git add . # 添加每个变化前,都会要求确认 # 对于同一个文件的多处变化,可以实现分次提交 $ git add -p # 删除工作区文件,并且将这次删除放入暂存区 $ git rm [ file1 ] [

Branching: different config files for release/development

时光毁灭记忆、已成空白 提交于 2019-11-27 07:26:16
I've inherited a project and we are using git. We have a number of environments (dev, test, prod). The previous team basically recreated everything on each instance, using the same accounts, passwords, sid, etc. The only thing that changed was the hostname mappings in /etc/hosts. So that it would connect to a different database server. Now, this creates a problem, because I can't, for example copy a schema so that a developer can run an experiment using the same database instance as the main development server. I basically have to create a new database instance on another host, and change /etc

Reordering of commits

六眼飞鱼酱① 提交于 2019-11-27 06:51:31
I'm currently working on a branch and want some commits to merge into other branches: a-b-c-d-e-f-g (branchA) / --o-x-x-x-x-x-x-x-x-x-x (master) \ x-x-x-x-x (branchB) (Letters denote commits, and the "x" are irrelevant commits.) However I noticed that it would be a good idea to pool some commits. I want to "concatenate" commit a, d, e and g into one patch and commit it to master. Commits b and f should go as one commit to branchB. Is there a good 'git'-ish way to achieve it? The command you're looking for is git rebase , specifically the -i/--interactive option. I'm going to assume you want to

How to create a remote Git branch without creating a local branch?

≯℡__Kan透↙ 提交于 2019-11-27 06:11:21
问题 I'd like to create a new remote branch for later use. The most commonly suggested way seems to be: git checkout -b newbranch origin/startingpoint git push origin newbranch But this will also create the branch locally and put me on it. Is there a way of creating a remote branch without creating it locally and moving onto it? 回答1: tl;dr: specify the full destination refname and you can push a commit directly: git push origin origin/startingpoint:refs/heads/newbranch you can push anything that

Which characters are illegal within a branch name?

那年仲夏 提交于 2019-11-27 06:06:55
Which characters are illegal within a branch name? Manoj Govindan Naming rules for refname: Git imposes the following rules on how references are named: They can include slash / for hierarchical (directory) grouping, but no slash-separated component can begin with a dot . or end with the sequence .lock . They must contain at least one / . This enforces the presence of a category like heads/ , tags/ etc. but the actual names are not restricted. If the --allow-onelevel option is used, this rule is waived. They cannot have two consecutive dots .. anywhere. They cannot have ASCII control

What is the equivalent of branch reset operator (“?|”) found in php(pcre) in C#?

别说谁变了你拦得住时间么 提交于 2019-11-27 05:59:22
问题 The following regular expression will match "Saturday" or "Sunday" : (?:(Sat)ur|(Sun))day But in one case backreference 1 is filled while backreference 2 is empty and in the other case vice-versa. PHP (pcre) provides a nice operator "?|" that circumvents this problem. The previous regex would become (?|(Sat)ur|(Sun))day . So there will not be empty backreferences. Is there an equivalent in C# or some workaround ? 回答1: .NET doesn't support the branch-reset operator, but it does support named

Fix GitLab error: “you are not allowed to push code to protected branches on this project”?

青春壹個敷衍的年華 提交于 2019-11-27 05:57:22
I have a problem when I push my codes to git while I have developer access in my project, but everything is okay when I have master access. Where is the problem come from? And how to fix it? Error message: error: You are not allowed to push code to protected branches on this project. ... error: failed to push some refs to ... Hcorg there's no problem - everything works as expected. In GitLab some branches can be protected. By default only Maintainer/Owner users can commit to protected branches (see permissions docs ). master branch is protected by default - it forces developers to issue merge

Depend on a branch or tag using a git URL in a package.json?

爷,独闯天下 提交于 2019-11-27 05:57:18
Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. How would I reference my fixed version in the dependencies of my package.json ? hurrymaplelad From the npm docs : git://github.com/<user>/<project>.git#<branch> git://github.com/<user>/<project>.git#feature\/<branch> As of NPM version 1.1.65, you can do this: <user>/<project>#<branch> per @dantheta's comment: As of npm 1.1.65, Github URL can be more concise user/project. npmjs.org/doc/files/package.json.html You can attach the branch like user

Switch branch names in git

可紊 提交于 2019-11-27 05:56:45
There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a different branch as my main development branch. I'm wondering how I could change things around so I'm working on master again but it doesn't have my junk work and said work is on a different branch. Some ways this could be asked/solved: How do I rename my master branch to