branch

Git: Commit to multiple branches at the same time

99封情书 提交于 2019-11-27 11:28:48
I want to make a single commit on different branches at the same time, since, in my project, I have different branches for different clients. Say, I have made a new feature commit on Branch A. Can I also make this commit on Branch B, Branch C and D at the same time as well? Is there any short cut command for this? This is very troublesome to checkout one branch, and cherrypick the commit everytime, sometime, if the commit is necessary on many branches, it would be a nightmare for me. Any simple bash script for this operation? There is a similar question in there. but rebasing is not that I

Git: How to list commits on this branch but not from merged branches

风格不统一 提交于 2019-11-27 11:24:37
Suppose your git commit history looks like this: A---B---C---D---E---F master \ / X---Y---Z topic Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch, I don't want it show. git log has option --first-parent , so you won't get topic history. When merged from master , the master commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff. There is another general way to go about this that doesn't rely on --first-parent which will be helpful in certain

Different default remote (tracking branch) for git pull and git push

不羁的心 提交于 2019-11-27 11:17:54
Is there a way to set up a git repository, so that git pull defaults to one remote and git push defaults to another? I know I can set both by changing the value of the remote variable in branch section of .git/config , but how to do it for each direction separately? Chris Johnsen For Git 1.6.4 and later, set remote.<name>.pushurl with git config . One might use this to pull using the read-only https: protocol and push using an ssh-based protocol. Say origin 's url ( remote.origin.url ) is https://git.example.com/some/repo.git . It is read-only, but you have write access through the ssh-based

Git Merge and Fixing Mixed Spaces and Tabs with two Branches

时光怂恿深爱的人放手 提交于 2019-11-27 11:14:18
I've gone through some similar SOQ's and have not seen an adequate solution for this case. I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab currently. Although this should have been addressed when it happened, I need to consider it now and would like to fix the files I come across. The issue is that there are two teams using different branches of code and we will eventually have to merge those branches. What will happen if we change all the files of our branch to be the correct formatting and try

Can you close a Mercurial branch without updating to it first?

旧时模样 提交于 2019-11-27 11:11:06
问题 I am aware that you can close a Mercurial branch with: hg update rev-number hg commit --close-branch -m "Closing branch." However, some of the repositories I work with a rather large, and after discovering a loose branch from years ago that I want to close, updating to it first can take many minutes (if not hours), only to do one commit and then update back to the original revision I was working from (more minutes, if not hours). So my question, is there any way to close a Mercurial branch

Subversion branch reintegration

倾然丶 夕夏残阳落幕 提交于 2019-11-27 11:10:47
When a branch is reintegrated to the trunk, is that branch effectively dead? Can you make modifications to the branch after the reintegration and merge those back into the trunk at a later date? Pini Reznik You can do it technically, you branch is not dead nor disabled, but it is not recommended to merge from branch to trunk after reintegration. You can find a full discussion about the reason for that, here: Subversion merge reintegrate Basically, it says, that it is possible to merge your changes again to the trunk, but since reintegration forces you to merge from trunk to branch prior to the

Force my local master to be origin/master

☆樱花仙子☆ 提交于 2019-11-27 11:03:52
问题 I've let master and origin/master get stuck in the sidelines, and am no longer interested in the changes on that branch. I followed these instructions to get my local master pointing to the right place Make the current git branch a master branch git checkout better_branch git merge --strategy=ours master # keep the content of this branch, but record a merge git checkout master git merge better_branch # fast-forward master up to the merge which worked fine except git status gives C:\data

Line endings messed up in Git - how to track changes from another branch after a huge line ending fix?

馋奶兔 提交于 2019-11-27 10:48:51
We are working with a 3rd party PHP engine that gets regular updates. The releases are kept on a separate branch in git, and our fork is the master branch. This way we'll be able to apply patches to our fork from the new releases of the engine. My problem is, after many commits to our branch, I realized that the initial import of the engine was done with CRLF line endings. I converted every file to LF, but this made a huge commit, with 100k lines removed and 100k lines added, which obviously breaks what we intended to do: easily merge in patches from the factory releases of that 3rd party

Git and working on multiple branches

◇◆丶佛笑我妖孽 提交于 2019-11-27 10:29:48
I have a couple of Git branches: 'experimental', 'something' and 'master'. I switched to the 'experimental' branch. I noticed a bug which is unrelated to 'experimental' and belongs to changes which have been made in 'something'. How should I fix it? I'm thinking I should switch to 'something', fix the bug, commit and then move back to 'experimental'. How should I take the minor change from 'something' and apply it to both 'master' and 'experimental' so that I don't have to re-fix the bug again when I switch into these branches? There are two solutions not mentioned already that you can use:

Git使用方法以及出现的bug解决方案

大兔子大兔子 提交于 2019-11-27 10:25:54
git常用命令 1.本地库初始化: git init 2.设置签名 (1)项目级别(项目里面) git config user.name xxx git config user.email xxx (2)系统级别(所有的项目) git config --global user.name xxx git config --global user.email xxx 3.查看状态: git status (查看工作区、暂存区状态) 4.添加操作 git add xxx (将工作区新建/修改的文件添加到暂存区,-A/.表示添加所有文件) 5.提交操作: git commit -m "说明" xxx (将暂存区的内容提交到本地库,若最后不跟文件名则提交所有) 6.查看历史记录 (1)git log (2)git log --pretty=oneline (3)git log --oneline (4)git reflog(HEAD@{横移到当前版本需要多少步}) 7.回退 (1)git reset --hard 版本号(git reflog 查出的第一列哈希值索引) (2)git reste --hard HEAD^ 回退一步(一个^表示一步) (3)git reste --hard HEAD~3 回退3步 8.分支管理 (1)git branch -v 查看本地库中所有分支 (2)git