1

I have forked a project and doing some changes on it during several commits. I want to know if I submit a merge request, history of all commits are available to maintainer or not?

I'm looking for a solution which all commits are aggregated as one commit and I don't know if it does happen during merge request or not? This is because I have do some trial-n-errors and I don't like that these trial-n-errors be visible to project maintainer.

VSB
  • 9,825
  • 16
  • 72
  • 145

2 Answers2

2

Yes, if you push your branch, all the history will be there. You can either

#1 Squash all your commits before you push your branch: see Git: How to squash all commits on branch how to do this

or

#2 Squash all your commits on merge: newer versions of gitlab have a feature that if you merge to master, all your commits will be automatically squashed before the actual merge: Gitlab Squash

See https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html for more information.

Personally I have done #1 before Gitlab could merge automatically. Now I do #2 all the time. If you don't want the history of all your commits available to the maintaner, you should do #1. Otherwise #2 will work just fine and the end result will be the same: One single commit for your changes.

mles
  • 4,534
  • 10
  • 54
  • 94
1

Yes, whatever you push, it will be the whole history up there. Some people like to squash commits before doing that. I see a lot of people using git rebase -i or git merge --squash for that. I like to do it by hand this way... say it's 10 commits you want to squash:

git reset --soft HEAD~10
git commit -m "blah blah"

Voila! There you have a squashed commit.

eftshift0
  • 26,375
  • 3
  • 36
  • 60