git-merge

GIT - how to merge branches?

♀尐吖头ヾ 提交于 2019-12-03 19:38:45
问题 We decided to use GIT in our company but now got a problem.. We have several branches with different features. Now what we need is to merge that branches and push it to Master. How shall we do that with autoreplace - we have branch-a, branch-b, branch-c - we need to get them all in Master but in case of repeated files the branch-b should be Major and branch-c - minor. Upd: branch-a: -file1 -file2 -file3 -file4 branch-b: -file1 -file5 -file6 branch-c: -file1 -file2 -file7 -file8 we need in

How to push/pull Git rebase

匆匆过客 提交于 2019-12-03 19:05:27
问题 I'd like to use git rebase so as to cleanly merge a feature in the master branch (in less commits or at least at the top of the change log). Note that I'm the only one working on the repository . After reading Git workflow and rebase vs merge questions, I found git rebase would be pretty nice and like Micah I'd like to git push rebased changes simply because I'm working on them from different places (ex: my notebook, my home, another PC somewhere...) So here are two solutions (to the bi

Removing large file from git history?

寵の児 提交于 2019-12-03 16:38:59
We have a remote git repository where there are no size restrictions for files and we had pushed a 300MB into it. We then realized it and then removed the file from the repository. Meanwhile the same repository was added to github and when we try to push the changes to github, we get the large file size error. remote: error: File dir/filename is 312.27 MB; this exceeds GitHub's file size limit of 100 MB To fix this, I tried using the interactive git rebase solution suggested at How to remove/delete a large file from commit history in Git repository? , but at the end of the rebase operation I

How do I change a commit message after a 'git-pull' auto-merge?

 ̄綄美尐妖づ 提交于 2019-12-03 16:33:51
Occasionally, my collaborators will "panic" when there is an automatic merge generated as the result a git-pull , and just accept the default commit message. Before this commit gets pushed, I want to be sure the message gets fixed, but --amend seems not to work. What is the best way to fix the message that's generated in this scenario. The best instructions I can come up with for them are git reset --soft HEAD~ git merge -m <message> <the tracked remote branch> but that seems a bit scary ( reset ) and error prone (the remote tracked branch has to be entered explicitly). Is there a simple way

Git warning: refname 'xxx' is ambiguous

こ雲淡風輕ζ 提交于 2019-12-03 16:25:15
问题 I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ; git checkout master git merge --no-ff hotfix-1 Created a tag for this point; git tag -a hotfix-1 -m "" and then I switched back to develop branch from master and merge 'hotfix-1' with ; git checkout develop git merge --no-ff hotfix-1 after merging 'hotfix-1' to develop I'm getting "warning: refname 'hotfix-1' is ambiguous" message and it's

git diff to see what a merge would introduce

时光总嘲笑我的痴心妄想 提交于 2019-12-03 16:17:27
So me and a friend have been working on a project. Most of the time merges are painless as we generally work in different areas. Recently we have been running into eachother more and more creating nasty merges (deadlines). So we began investigating ways to see what a merge would do. I found a way to use git diff: git diff mybranch...hisbranch This gives pretty good results. The problem is, since that it uses the last common ancestor, and that ancestor is getting farther and farther back there is a lot of junk in the merge that hasn't been changed in either of our branches. So I'm wondering is

Merging after directory got turned into submodule

我的未来我决定 提交于 2019-12-03 15:57:48
问题 I find that working with git submodules, I often encounter problems merging between commits which do contain a given submodules and those which represent the same code as a normal directory. Small reproducing example: # Create one project, to be used as a subproject later on git init a cd a echo aaa > aa git add -A git commit -m a1 cd .. # Create a second project, containing a as a normal directory initially git init b cd b mkdir a b echo aaa > a/aa echo bbb > b/bb git add -A git commit -m b1

How to configure “git pull --ff-only” and “git merge --no-ff”

不想你离开。 提交于 2019-12-03 15:16:09
问题 A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option. I also make local branches for feature work. I want to preserve the branch history, so when I merge the local branch back to my local clone, I use the --no-ff option. How can I configure git to use those options by default? Currently my .gitconfig looks like this: [merge] ff = false [pull] ff = only However, git pull

git merge --no-commit vs git cherry-pick --no-commit

拜拜、爱过 提交于 2019-12-03 14:28:13
问题 Is there any difference between git merge --no-commit and git cherry-pick --no-commit ? And is there any difference in history if I commit after these two commands? 回答1: If you commit after git merge --no-commit , you'll actually get a merge commit. Whereas after a git cherry-pick --no-commit you'll get a commit with a single parent. Hence, yes, there is a difference between those two commands. In particular if you have something like A -- B -- C \ L HEAD \ -- D -- E If you cherry-pick commit

Managing local-only changes with git

人走茶凉 提交于 2019-12-03 12:34:59
问题 On my local branch, I have some personal (local-only) changes to a Makefile (just changing the path to the compiler). Obviously I don't want to commit those changes in as they are only relevant to me. However, if I don't commit them then I get an error when I try to sync with the remote branch: % git fetch upstream % git merge upstream/master error: Your local changes to 'Makefile' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.