git-merge

Git - How to selectively apply changes from one branch to another?

醉酒当歌 提交于 2019-12-21 03:39:30
问题 Is it possible to selectively apply changes from one branch to another with Git? More specifically, I use a public dev branch for GitHub and a private master branch for deployment. When changes are made to one branch they will need to be applied to the other, but some lines of code need to stay different. In my case it's a few css classes and a feed. I'm new to Git but I've made my research : git merge --no-commit --no-ff can be used followed by a git mergetool to chose what I want in case of

Override author on git merge

此生再无相见时 提交于 2019-12-21 03:19:38
问题 Is there an option like --author of git-commit for git-merge? We maintain a staging environment where some changes must be performed. Some limitations make us to use only one linux user to access staging environment. Anyway, we are a small team with cooperative initiative and we tell when doing commits, which one is the author using the --author git-commit option. However, some times we need to merge from other branches which result in a non-ff merge. This implies a commit is performed when

How can I merge last two commits?

Deadly 提交于 2019-12-20 20:35:56
问题 I want to combine my last two commits. Here is the result of git log : Now I want to merge those last two commits (which are into read box) into one commit. How can I do that? 回答1: There are many ways to do it (using rebase or reset ). The approach using git reset: No matter the approach, before anything else make sure the working copy is clean. Use git status to find out. If there are uncommitted changes either save them in a stash (git stash or commit them on a temporary branch. Run git

Git: best way to remove all changes from a given file for one branch

懵懂的女人 提交于 2019-12-20 12:42:21
问题 I have a bit of a messy branch with 20 or so commits, and I'm preparing for a merge back to master. I've rebased it off master, and looking closer, I realise that there are files being modified in ways that are totally irrelevant to this branch, and not ready to be committed. The changes to those files aren't confined to specific commits. So basically, I don't want anything to do with those files to be included in this branch if possible. Is there a good way to go about this? My fall back

Git: How to checkout merge request locally, and create new local branch?

谁说胖子不能爱 提交于 2019-12-20 10:28:05
问题 I have gitlab repository there I need to test every merge request locally, before merging to target branch. How can I pull/fetch merge request as a new branch? 回答1: Pull merge request to new branch git fetch origin merge-requests/REQUESTID/head:BRANCHNAME i.e git fetch origin merge-requests/10/head:file_upload Checkout to newly created branch git checkout BRANCHNAME i.e ( git checkout file_upload ) OR with single command git fetch origin merge-requests/REQUESTID/head:BRANCHNAME && git

How do I merge a branch into a master in github?

倖福魔咒の 提交于 2019-12-20 09:59:55
问题 I created a repo and github, and pushed my files to it. Then had a colleague create a branch and make changes. I want to merge the branch to master. What steps do I take? 回答1: Please do following set of commands in order to merge with the master , Assuming that you are in branch testBranch and you want to merge the changes with the master , First checkout to master branch, git checkout master Now pull the latest changes in master , git pull origin master Merge with the testBranch git merge

Best practice for tracking upstream in fork on github

早过忘川 提交于 2019-12-20 09:20:04
问题 Summary: What are the best practices for handling long running tracking of upstream repositories where you want to maintain a set of local changes? I want to keep a fork on github up-to-date with the upstream but still allow clear tracking of changes unique to the fork. (for this discussion, assume that upstream points to the main project repository and that origin refers to my fork of the repository) Imagine I have something like this where I forked a repository when upstream/master was at E

block push of trivial merge to git server

别等时光非礼了梦想. 提交于 2019-12-20 08:44:04
问题 A while back I asked our developers to use rebase instead of merge before pushing. Eliminating trivial merges makes for a much easier to follow commit graph (ie: gitk, git log). Sometimes folks still accidentally do trivial merges, then push. Does anyone have handy or have tips for writing a server-side hook that blocks trivial merges? By "trivial merge", I mean a merge without conflicts. Here's an example, and here's a better explanation of a trivial merge in git. Update Wed Nov 10 01:26:41

block push of trivial merge to git server

落花浮王杯 提交于 2019-12-20 08:42:16
问题 A while back I asked our developers to use rebase instead of merge before pushing. Eliminating trivial merges makes for a much easier to follow commit graph (ie: gitk, git log). Sometimes folks still accidentally do trivial merges, then push. Does anyone have handy or have tips for writing a server-side hook that blocks trivial merges? By "trivial merge", I mean a merge without conflicts. Here's an example, and here's a better explanation of a trivial merge in git. Update Wed Nov 10 01:26:41

How to make git merge handle uncommitted changes to my working tree?

拥有回忆 提交于 2019-12-20 08:24:19
问题 A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge them: $ git merge origin/master Updating 1b8c5c6..eb44c23 error: Entry 'blah.java' not uptodate. Cannot merge. Coming from a subversion background, I'm used to having my working tree automatically merged when I pull changes from the repository and if there