git-branch

How to protect “master” branch in GitHub?

喜欢而已 提交于 2019-12-01 23:23:06
We are a team of a few people. Everyone works on a feature branch and merges his stuff through GitHub UI into master when one is ready. Now is it possible to prevent direct pushes to master , but instead create a pull request whenever a new feature is ready to be merged? Additionally it would be awsome to restrict merges to a subset of devs only. Additionally it would be awsome to restrict merges to a subset of devs only. You can restrict pushes to a branch in an Organization to specific users or teams. This will allow you to set up a team that can merge back into master . Alternatively, for a

Can I pull only certain files from another git repository?

岁酱吖の 提交于 2019-12-01 23:09:25
For instance, suppose I have Repository 1 and Repository 2. Repository 1 has a file /a/b/c/d . Would it be possible for me to import this file into Repository 2 as /e/f/g/h ? The reason being that I want to pull in changes from an experimental branch from a different git repository. I tried merging everything together, but there were a ton of conflicts (of every kind). Therefore, I doubt that I can merge the entire branch in, but I would like to try to bring in as much as I can. Is there any way to do what I want to do, or am I just going to have to resort to copying files directly? You can

How to turn a git branch into fork?

醉酒当歌 提交于 2019-12-01 20:44:20
问题 I have created a branch in my GitHub repo: https://github.com/markmnl/FalconUDP, so there are now two branches: "master" and "single-threaded". I realise now I will never want to merge "single-threaded" back into "master" and want to maintain each branch separately independently of one another, though from time-to-time I will want to cherry pick bits of code from one into the other. It would be disastrous should the branches be accidentally merged (though not catastrophic of course since I

How to turn a git branch into fork?

本小妞迷上赌 提交于 2019-12-01 19:20:59
I have created a branch in my GitHub repo: https://github.com/markmnl/FalconUDP , so there are now two branches: "master" and "single-threaded". I realise now I will never want to merge "single-threaded" back into "master" and want to maintain each branch separately independently of one another, though from time-to-time I will want to cherry pick bits of code from one into the other. It would be disastrous should the branches be accidentally merged (though not catastrophic of course since I can always go back - it being in source control). It strikes me what I should have done is fork the

Why is “git branch” silent in new repositories?

孤街醉人 提交于 2019-12-01 09:39:54
When you create a new repository and run git branch , it exits silently. For example: $ mkdir /tmp/foo; cd /tmp/foo; git init Initialized empty Git repository in /tmp/foo/.git/ $ git branch Why doesn't the command provide any output, or show the master branch? TL;DR No branch heads exist yet. Detailed Explanation A Git repository has no branches until you make your first commit. A newly-initialized repository sets HEAD to refs/heads/master, but refs/heads/master won't exist or contain a commit pointer until after the first commit is made. During a commit, Git dereferences the symbolic-ref HEAD

Keep settings in branch

这一生的挚爱 提交于 2019-12-01 08:42:40
I begin to use git for software development. I have a project on github. This project also involves some user-settings stored in dedicated settings-files. On github the settings should be empty (like this) ### Settings: ## Your name $name = ""; ## Your email adress $email = ""; ## and so on However, I also have the project running on my computer (or server). My personal version of the project should have all settings filled out. I would like to have two branches for that. The personal branch should contain all my settings. The master branch should be the one where I develop the software and

git change default branch (gitolite)

橙三吉。 提交于 2019-12-01 08:40:50
I've got a repository with branches: master and devel. Master is the default one. I want to rename master into prod and make it default (and push it to the server). How to do this? Repository is hosted in gitolite (if it matters). VonC You need to have access to the server in order to change the symbolic-ref of HEAD to the branch you have pushed there ( prod ). git-symbolic-ref HEAD refs/head/prod I tentatively proposed a way to do that from a client at the end of " How do I change a Git remote HEAD to point to something besides “master” ", but it is easier if you can log on the server

Keep settings in branch

牧云@^-^@ 提交于 2019-12-01 06:19:22
问题 I begin to use git for software development. I have a project on github. This project also involves some user-settings stored in dedicated settings-files. On github the settings should be empty (like this) ### Settings: ## Your name $name = ""; ## Your email adress $email = ""; ## and so on However, I also have the project running on my computer (or server). My personal version of the project should have all settings filled out. I would like to have two branches for that. The personal branch

Git : Merge multiple commits from one branch into another

时间秒杀一切 提交于 2019-12-01 05:53:47
I have following use case. I have a mainline branch. Created new branch(dev) from mainline . Did multiple commits(around 20) into dev branch and pushed into dev (remote) branch as well. Now I want to merge all these 20 commits into single commit and move this to mainline . How exactly I can do this? Thanks in Advance, Shantanu VonC That sounds like a git merge --squash git checkout mainline git merge --squash dev git commit Note that, as commented here , it is best to merge mainline in dev first and solve any conflict there, before merging back dev in mainline . 来源: https://stackoverflow.com

Git listing non-existent remotes

做~自己de王妃 提交于 2019-12-01 05:15:40
I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin. For example, I had this previously: [remote "origin"] url = blah blah [remote "future"] url = blah blah I went in and changed them so they look like this: # formerly the origin [remote "old-origin"] # formerly the future repo [remote "origin'] But now, when I type git branch -a , I am seeing branches listed from the old 'future' remote: remotes/origin/HEAD remotes/origin/branch1 remotes/origin/branch2 remotes/future