2

I have i18n branch on GitLab. Where i have already made few commits with pushes. The problem: Client wants me to make merge request to master branch but only with some specific files (

select the smallest possible set of changes

). How is it possible ? As i see it gathers all commits to merge request...so what should i do here ? i thought about creating third branch and commit there this small set of changes..but that's ridiculous...

Nikita P
  • 149
  • 5
  • 19

2 Answers2

1

You could try and apply a solution similar to "How do you merge selective files with git-merge?":

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • for the first command in said: Already up to date, for second : nothing... then i tried git commit..also nothing.. – Nikita P Feb 17 '15 at 14:33
  • @NikitaP are you one the `master` branch (the one where the merge should take place)? Did you already do a merge between `i18n` and `master`? – VonC Feb 17 '15 at 14:33
  • I'm on the i18n branch..i should switch to master and try this ? – Nikita P Feb 17 '15 at 14:34
  • @NikitaP well, if you want to merge `i18n` *to* `master`, then yes, being on `master` (the target environment for that merge) is a pre-requisite. – VonC Feb 17 '15 at 14:35
  • okey. i switched ..now it wrote : Automatic merge went well; stopped before committing as requested. Then after second command it didn't wrote anything but changed current branch to (master|MERGING)...then git status showed correct 2 files that i'm trying to merge..then "git commit"...and now i should git push to create merge request? – Nikita P Feb 17 '15 at 14:44
  • @NikitaP yes, but I would recommend pushing on a dedicated branch for making that merge request. – VonC Feb 17 '15 at 14:51
  • so anyway i'l have to create 3-d branch to make this merge request ? I tried to do git push..and failed because of no permission access. Then maybe it's easier to create 3-d branch from the start, copy-paste modified/new files and make merge request ? Or i didn't understood ur last message..sry for my english. – Nikita P Feb 17 '15 at 14:57
  • @NikitaP you can create your branch after the merge and the commit in `master`. That new branch would reference the same content as the `master` branch (with the new commit from the merge), but you would have the right to push that new branch as opposed to `master`. – VonC Feb 17 '15 at 15:02
0

Sounds like your client just wants you to squash your commits on your i18n branch before you create you merge request. You do this using interactive rebase in git on your i18n branch.

git rebase -i HEAD~4

This will let you interact with the last 5 commits, change the number to get the commits you want.

In the interactive rebase, keep the first commit of your changes as a 'pick' and change the rest to 'squash'

When you save it will give you the opportunity to change the commit message of the squashed commits.

For more information see: https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history

Dave Powers
  • 2,051
  • 2
  • 30
  • 34
twk3
  • 1,848
  • 13
  • 7