Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testcase notes] #31: Conflict, default commit messages #78

Open
dorawyy opened this issue Nov 16, 2017 · 3 comments
Open

[testcase notes] #31: Conflict, default commit messages #78

dorawyy opened this issue Nov 16, 2017 · 3 comments

Comments

@dorawyy
Copy link
Owner

dorawyy commented Nov 16, 2017

1. git merge conflict

Way1: Default merge

After resolving the conflict, if git commit directly without attaching -m and customized commit message, then go to the default commit message page

git merge Branch

# conflict show up
# after resolving conflict, continue merge

git add file_with_conflict
git commit 

The default message for the merge commit is:
1510864113956

wx20171116-125127 2x

Conclusion:

  • The conflict message is included in the commit message but commented out by default.
  • Default message will mention this is a merge commit
  • In the following, we will see this is the same as Way2 (with --no-commit param)

Way2: --no-commit (same as default merge)

When merging, use --no-commit param:

git merge Branch --no-commit

# conflict show up
# after resolving conflict, continue merge

git add file_with_conflict
git commit 

wx20171116-124440 2x

1510865628010

Conclusion:

  • The conflict message is included in the commit message but commented out by default.
  • Default message will mention this is a merge commit
  • same as default merge (way1)

Way3: --squash

When merging, use --squash param:

git merge Branch --squash

# conflict show up
# after resolving conflict, continue merge

git add file_with_conflict
git commit 

wx20171116-123411 2x

wx20171116-125242 2x

Conclusion:

  • The conflict message is included in the commit message but commented out by default.
  • No indication says this commit is from a merge process
@dorawyy
Copy link
Owner Author

dorawyy commented Nov 16, 2017

2. git rebase conflict

default rebase

git checkout TestC
git rebase TestD

The first conflict during rebase
wx20171116-132523 2x

This is the conflict file:
wx20171116-131753

Resolved as:
wx20171116-132334

Current status:
wx20171116-132704 2x

Then continue rebase, and the rebase is done:
1510867729847

The project history becomes:
screen shot 2017-11-16 at 12 32 38 pm 2

No hint at all.

Conclusion:

  • No indication for rebase itself
  • No indication for conflicts during rebasing

@dorawyy
Copy link
Owner Author

dorawyy commented Nov 16, 2017

3. git revert conflict

Way1: Default revert

git revert head^

# conflict
# resolve conflict, then continue revert

git add file_with_conflict
git revert --continue

wx20171116-134124 2x

wx20171116-134336 2x

Conclusion:

  • By default, have revert keyword in the default commit message
  • By default, conflict message is commented in the default commit message

Way2: --no-commit when reverting

git revert head^ --no-commit

# conflict
# resolve conflict

git add file_with_conflict
git revert --continue

1510870260039

wx20171116-141354 2x

wx20171116-141615 2x

Conclusion:

  • By default, have revert keyword in the default commit message
  • By default, conflict message is commented in the default commit message
  • Same as default revert

@dorawyy
Copy link
Owner Author

dorawyy commented Nov 16, 2017

4. pull request conflict

4.1 Original state of the pull request:

screen shot 2017-11-16 at 4 33 34 pm

4.2 Have to resolve conflict before merging the pull request

4.2.1 Merge to resolve conflict (on head fork repo)

wx20171117-102708 2x

![wx20171117-102857](https://user-images.githubusercontent.com/16771854/32962687-3e98aeca-cb82-11e7-8f01-9a650276eabc.png)

4.2.1.1 Way1: Github online editor (on head fork repo)

wx20171116-163645

Here is the default commit message of the merge conflict resolved with Github online editor:

wx20171116-163922

Conclusion:

  • Can see it is a merge;
  • No indication for Conflict

4.2.1.2 Way2: Local machine resolution (on head fork repo)

Go to head_fork repo (aka. pull request repo) --> dorawyy in this case

git checkout Feature1
git pull Upstream_repo_url Feature1

# would meet conflict here, resolve the conflict
# continue merge

git add conflict_file
git commit

Conflict:
screen shot 2017-11-17 at 10 47 06 am

Conflict-resolved version:
screen shot 2017-11-17 at 10 48 01 am

By default, conflict info is included in commit message
wx20171117-104945 2x

wx20171117-105110 2x

Conclusion:

  • The conflict message is included in the commit message but commented out by default.
  • Default message will mention this is a merge commit

4.2.2 Rebase to resolve conflict(on head fork repo) (git pull --rebase)

# go to head fork repo

git checkout Feature1
git pull upstream_repo Feature1 --rebase

# rebase conflict
# resolve rebase conflict

git add conflict_file
git rebase --continue

wx20171117-142228
wx20171117-142427 2x

4.3 No conflict when merging the pull request

4.3.1 Merge

Merge conflict is already resolved

4.3.2 Squash

Merge conflict is already resolved

4.3.3 Rebase

This option will be disabled if having potential conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant