branch

How to clone a single branch in git?

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a local git repository called 'skeleton' that I use for storing project skeletons. It has a few branches, for different kinds of projects: casey@agave [~ /Projects/ skeleton ] git branch * master rails c c ++ If I want to check out the master branch for a new project, I can do casey@agave [~/ Projects ] git clone skeleton new Initialized empty Git repository in / Users / casey / Projects / new /. git / and everything is how I want it. Specifically, the new master branch points to skeleton master branch, and I can push and

How to do a GitHub pull request

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I create and/or send a pull request to another repository hosted on GitHub? 回答1: (In addition of the official " GitHub Help 'Using pull requests' page ", see also " Forking vs. Branching in GitHub ", " What is the difference between origin and upstream in GitHub ") Couple tips on pull-requests: Assuming that you have first forked a repo , here is what you should do in that fork that you own: create a branch : isolate your modifications in a branch. Don't create a pull request from master , where you could be tempted to accumulate and

Adding git subtree from a branch

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to add a repo (called cow) to my project using git subtree add . In particular, I'd like to add the branch stable (which is not the master branch). I tried: git subtree add -P cow https://github.com/geoffryan/cow.git stable But this returned the error 'stable' does not refer to a commit. I also tried: git subtree add -P cow https://github.com/geoffryan/cow.git cow/stable 'cow/stable' does not refer to a commit. And: git subtree add -P cow https://github.com/geoffryan/cow.git ca26d248a12c21264e32a2c212381cafb578c9fb

Writing a git post-receive hook to deal with a specific branch

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Here's my current hook in a bare repo that lives in the company's server: git push origin master This hooks pushes to Assembla. What i need is to push only one branch (master, ideally) when someone pushes changes to that branch on our server, and ignore pushes to other branches. Is it possible to select the branch from a bare repo and push only that branch to Assembla? 回答1: A post-receive hook gets its arguments from stdin, in the form . Since these arguments are coming from stdin, not from a command line argument, you need to use

How do I list and fetch remote branches after SVN to Git migration? [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: How do I migrate an SVN repository with history to a new Git repository? 32 answers I migrated our SVN repository to Git and pushed it to a central repository. We had a fair amount of tags and branches, but somehow we were not able to list and fetch those from a Git client. This was weird, because the tags and branches seemed to be available on the server. With help from a Jon Maddox blog post , a blog post from Marc Liyanage and a SO answer from Casey I was able to stitch a solution together. Thanks

What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What are the differences between the following commands?: git diff foo master # a git diff foo..master # b git diff foo...master # c The diff manual talks about it: Comparing branches $ git diff topic master $ git diff topic..master $ git diff topic...master Changes between the tips of the topic and the master branches. Same as above. Changes that occurred on the master branch since when the topic branch was started off it. but isn't totally clear to me. 回答1: Since I'd already created these images, I thought it might be worth using them in

How do I force “git pull” to overwrite local files?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I force an overwrite of local files on a git pull ? The scenario is following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under source control) They are sending the images by mail, later, to me I'm adding the images under the source control and pushing them to GitHub together with other changes They cannot pull updates from GitHub because Git doesn't want to overwrite their files. The errors I'm getting are: error: Untracked

git-branch command behaves like less

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: When I use the git branch command to list all branches, what I see is the output of git branch | less The command git branch is supposed to show a list of branches, like ls does for files. This is the output I get: How I get the default behaviour of git branch ? What causes the paged output? I am using ZSH with oh_my_zsh (nothing for git in there) and my .gitconfig looks like this. [ user ] email = myemail@mail . com name = Dennis Haegler [ push ] default = simple [ merge ] tool = vimdiff [ core ] editor = nvim excludesfile =

git checkout by date

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on a regression in the source code. I'd like to tell git: "checkout the source based on a parameterized date/time". Is this possible? I also have staged changes in my current view that I don't want to lose. Ideally I would like to toggle back and forth between the current source, and some version I'm interested in based on a previous date. 回答1: To keep your current changes You can keep your work stashed away, without commiting it, with git stash . You would than use git stash pop to get it back. Or you can (as carleeto said) git

git: How to delete a local ref branch?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have bit of a difficulty in deleting a local ref branch(refs/notes/origin/commits). I was able to delete the branch(refs/notes/origin/commits) in the remote repository using the command git push origin :refs/notes/origin/commits but when i try to delete the same branch on my local repository, i get the below error [User@centos Clone]# git branch -rd refs/notes/origin/commits error: remote branch 'refs/notes/origin/commits' not found. Any suggestions? 回答1: Just do git branch -d commits to delete the local branch. Use the -D switch to delete