GithubHelp home page GithubHelp logo

vubao108 / merge-conflict Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.17 MB

Home Page: https://lab.github.com/githubtraining/managing-merge-conflicts

License: MIT License

Ruby 13.92% HTML 52.98% CSS 33.10%

merge-conflict's People

Contributors

beardofedu avatar brianamarie avatar hectorsector avatar hollenberry avatar snyk-bot avatar

Watchers

 avatar

merge-conflict's Issues

Welcome

Welcome to Managing Merge Conflicts ๐ŸŽ‰

Hello, and welcome! If you're here to learn about and practice resolving merge conflicts, you're in the right place.

In this course, you'll learn why merge conflits happen by solving four merge conflicts. All of the merge conflicts in this course will be simple enough to solve from within the GitHub.com user interface, but if you'd prefer, you can solve them using the command line or other local tools.

As an added bonus, the project we are using for this course is a resume hosted on GitHub Pages! So, if you want to keep working after you complete this course, please feel free!

Note: You may notice that some branches and pull requests already exist. We'll be using them in later activities in this course.

How merge conflicts happen

Version control lets you make incremental changes to your code or file base while keeping the history. Git operates as a linked list, so a small history of three commits ๐Ÿ“– might look like this:

three commits in a linked list format

In the GitHub Flow, you...

  • first create a new branch ๐Ÿ“– off of the base branch, which is really just a reference point to a commit on the base branch.

add a branch

  • Next, you add one or more commits that, for now, exist only on your branch. The other commits stay fixed to their reference point in history.

branch with new commit

  • Finally, you open a pull request ๐Ÿ“– to propose that your new commits be included in the base branch, optionally add more commits, and then merge ๐Ÿ“– and delete your branch!

A Merge conflict occurs when someone else made a change on the base branch in the same file and location where you proposed changes. This usually happens when someone else merges in their branch before you merge yours.

This can be intimidating, but have no fear, Git knows how to handle this! It only needs a human to decide how to resolve the conflict.

Step 1: Create a Pull Request

Before we get too far ahead of ourselves, let's first practice making a simple change on a branch. Visualize your actions using the flow you reviewed above.

โŒจ๏ธ Activity: Create a normal pull request

  1. Open your preferred command line interface, which we'll call your shell from now on.

  2. Clone this repository:

    git clone https://github.com/vubao108/merge-conflict.git
  3. Navigate to the repository in your shell:

    cd merge-conflict
  4. Create a change-skills branch:

    git checkout -b change-skills
  5. Edit _data/skills.yml file to add a skill or two that you're proficient in

  6. Stage and commit your change:

    git add _data/skills.yml
    git commit -m "<YOUR-MESSAGE>"
  7. Push the branch to GitHub:

    git push --set-upstream origin change-skills
  8. On GitHub, create a Pull Request with the base set to master and the compare set to change-skills.

  9. ๐Ÿšง Don't merge yet! ๐Ÿšง Refresh the pull request to receive the next comment/instructions.

For a printable version of the steps in this course, check out the Quick Reference Guide.


Look for my next response in your pull request

Sometimes I respond too fast for the page to update! If you perform an expected action and don't see a response from me, wait a few seconds and refresh the page for your next steps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.