Skip to content

Practice: conflict #7

@yeonns

Description

@yeonns

Practice: conflict

  1. Create feat/conflict branch at local and create conflict/Conflict.java file like below.
public class Conflict {

    public static Integer getLength(String str) {
        return str.length();
    }

    public static void main(String[] args) {
        String s1 = "hello";
        System.out.println("hello's length: " + getLength(s1));
    }
}
  1. Commit and push to your forked repository
$ git add .
$ git commit -m "feat: conflict commit"
$ git push <YOUR_ID> feat/conflict
  1. Make PR, then you can check conflict.
    feat/conflict_base ◀️ feat/conflict

  2. Merge feat/conflict_base at local

$ git merge origin feat/conflict_base
  1. Resolve conflict like below
package conflict;

public class Conflict {

    public static Integer getLength(String str) {
        return str.length();
    }

    public static void main(String[] args) {
        String s1 = "hello";
        String s2 = "world";
        System.out.println("hello world's length: " + getLength(s1));
    }
}
  1. Push commit to feat/conflict
$ git add .
$ git commit -m "fix: resolve conflict"
$ git push <YOUR_ID> feat/conflict
  1. Result should be like below!
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions