branch

How to allow per user protected branches access in GitLab?

拈花ヽ惹草 提交于 2019-11-28 00:58:41
问题 GitLab allow me create protected branches and then specified witch users will have push access to those protected branches. But what about if I want some users access to some, but not all protected branches on the same repo? I mean, a more discrete/granulated user-branch permissions. 回答1: Those types of permissions do not exist in GitLab. As an alternative approach: you can make the user unable to commit to the main repository and then use the Project forking workflow allowing them to fork

pull-only repo's 'git status' saying the branch is ahead of origin/master. Why?

走远了吗. 提交于 2019-11-27 23:53:25
问题 So here's the situation: $ git status # On branch master # Your branch is ahead of 'origin/master' by [x] commits. # There are several questions about this on SO already, but none seem to specifically address the type of scenario I have. This answer to one of the questions comes closest, but doesn't go into detail. I'll just quote it verbatim: If you get this message after doing a "git pull remote branch", try following it up with a "git fetch". Fetch seems to update the local representation

Git复习(十三)之git revert和git reset区别

北慕城南 提交于 2019-11-27 23:33:18
git revert用法以及与git reset的区别 git revert用法 git revert 撤销 某次操作,此次操作之前和之后的commit和history都会保留,并且把这次撤销 作为一次最新的提交 * git revert HEAD 撤销前一次 commit * git revert HEAD^ 撤销前前一次 commit * git revert commit (比如:fa042ce57ebbe5bb9c8db709f719cec2c58ee7ff)撤销指定的版本,撤销也会作为一次提交进行保存。 git revert是提交一个新的版本,将需要revert的版本的内容再反向修改回去, 版本会递增,不影响之前提交的内容 git revert 和 git reset的区别 1. git revert是用一次新的commit来回滚之前的commit,git reset是直接删除指定的commit。 2. 在回滚这一操作上看,效果差不多。但是在日后继续merge以前的老版本时有区别。因为git revert是用一次逆向的commit“中和”之前的提交,因此日后合并老的branch时,导致这部分改变不会再 次出现,但是git reset是之间把某些commit在某个branch上删除,因而和老的branch再次merge时,这些被回滚的commit应该还会被引入。 3.

Git doesn't clone all branches on subsequent clones?

寵の児 提交于 2019-11-27 23:13:20
I have some problems with Git using cloned repositories and branches and it's somehow not possible for me to find an answer to this. Let me describe: we have a bare master Git repository here we all pull from and push to, located on a local linux machine and reachable with ssh. I made a clone of this to my usb thumb drive like this: git clone ssh://adahl@gollum//net/repos/netcube/patches.git This gives me of course a local clone with a working copy on my thumb drive. I cd to this and see some branches in this clone then: cd patches git branch -a * master remotes/origin/HEAD -> origin/master

Git rebase subtree

空扰寡人 提交于 2019-11-27 23:08:12
Suppose I have the following scenario: o (master) / o--o (WIP1) / / o--o--o--o--o--o (WIP2) (X) \ o--o (WIP3) Is there a git command which creates a new branch so that it contains the subtree after branch X? I want to perform a "large rebase", I want the three WIP branches rebased on master. I know I can do that with some Bash scripting but I'd like to know how to do that using a git command. There is no single git command for that. You will have to do some manual work. In your situation: o (master) / o--o (WIP1) / / X--o--o--B--o--o (WIP2) \ o--o (WIP3) You first rebase WIP1 onto master: git

Adapting svn:externals usage for move to Mercurial

与世无争的帅哥 提交于 2019-11-27 22:35:00
We've got in a corporate environment an svn repository structure which looks like this: root libs shared_lib1 shared_lib2 private_lib public_code private_code where public_code is an external repository which is open source and where people from outside the company have read-write-access. shared_lib1 and shared_lib2 are also external repositories shared with a different group of programmers from an other company. I'm the maintainer and can do basically whatever is technically best, the outside users will have to adapt. I'm now wondering what the best way is to move from this structure to a

单一职责原则

拈花ヽ惹草 提交于 2019-11-27 22:01:36
单一职责是指一个类或者方法出现两种以上职责,一旦需求的变更,这时候要修改一项职责,有可能就会影响到另一个职责。 解决办法: 将两个职责用两个类来实现,进行解耦。 发现: 既然单一职责原则规定我们尽量不要把不同的职责写在同一个方法内,但是java又提供重载这一机制。 public class ICompany { public void create(String branch){ if("人事".equals(branch)){ System.out.println(branch+"招人"); }else System.out.println(branch+"推市场"); } } public static void main(String[] args) { ICompany iCourse=new ICompany(); iCourse.create("人事"); iCourse.create("销售"); } 下面把两个职责分别写两个类实现 public class ICompanyHr { public void create(String branch){ System.out.println("招聘"); } } public class ICompanySell { public void craete(String branch){ System.out

git push 报错:failed to push some refs to 'git@git.xxxx:devops/thor.git'

江枫思渺然 提交于 2019-11-27 21:54:58
error: failed to push some refs to 'git@git.caicaivip.com:devops/thor.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 这种是由于你的 配置文件冲突了 ,配置文件进行了修改之后报错了 你需要直接把上面的代码拉下来然后,解决冲突 如果: git pull 分支名还报错了 就需要指定了   git push origin 分支名 appledeMacBook-Air-70:thor apple$ git pull zyl fatal: 'zyl' does not appear to be a git repository fatal: Could not read from remote repository. Please make

git: checkout files from another branch into current branch (don't switch HEAD to the other branch)

核能气质少年 提交于 2019-11-27 21:47:43
I want to load a different version of the files that exist in another branch into my current branch. git help checkout says: DESCRIPTION Updates files in the working tree to match the version in the index or the specified tree. If no paths are given, git checkout will also update HEAD to set the specified branch as the current branch. Is there a way to checkout all those files, but not update HEAD? checkout by providing the current path, . : git checkout other-branch-name -- . This operation is similar to switching HEAD to another branch without checking out files , but just from the "other

Discard a local branch in Mercurial before it is pushed

假装没事ソ 提交于 2019-11-27 21:34:32
问题 Many times it happens that I have few commits on my local Hg repository which I don't want to push and sometimes I want to remove the local branch altogether. But I cannot rollback more than one commit which leaves me no choice than creating a new clone and download the whole repository again. This feels stupid, since if I could just delete my local branch which has not affected the remote repository in anyway, then I wouldn't have to create and setup a new clone. So, is it how it is in