GithubHelp home page GithubHelp logo

branching-git-story's Introduction

Introduction to Git Branching

What is Git Branching?

Imagine you're writing a story and want to try out different endings without losing your original work. In coding, Git branching lets you do just that. It's like creating a new copy of your code where you can make changes, try new ideas, or fix issues, separate from your main code. This way, you can experiment without messing up your original project. Once you're happy with the changes, you can bring them back into your main project, like choosing the best ending for your story.

Why Use Branching Instead of Just Committing?

When you just commit changes, you're adding to your main project. It's like writing your story straight without drafts. Branching lets you work on drafts. You can have different branches for different features or fixes. This keeps your main project stable while you work on improvements. Once you're sure about a branch, you merge it into your main project, combining your drafts into your final story.

Step 1: Setup Your Story Repository

  • Fork the Story Repository: Visit coach's GitHub repository for the story and click on "Fork" to create a copy in your account.

  • Clone Your Forked Repository: Copy the forked repository to your local machine:

    git clone [URL of your forked repository]

Step 2: Write the Main Story

  • Navigate to Your Repository:

    cd [repository name]
  • Create a Main Story File:

    touch main-story.txt
  • Add a Basic Storyline:

    open main-story.txt

    Write a basic outline of your story, save, and close the file.

  • Commit Your Main Story:

    git add main-story.txt
    git commit -m "Add main storyline"

Step 3: Create Different Introductions

Introduction 1

  • Create and Switch to 'Intro 1' Branch:

    git checkout -b intro-1
  • Write Introduction 1:

    open intro1.txt

    Write the first version of your story's introduction, save, and close.

  • Commit Introduction 1:

    git add intro1.txt
    git commit -m "Add Intro 1"

Introduction 2

  • Switch Back to Main and Create 'Intro 2' Branch:

    git checkout main
    git checkout -b intro-2
  • Write Introduction 2:

    open intro2.txt

    Write the second version of your story's introduction, save, and close.

  • Commit Introduction 2:

    git add intro2.txt
    git commit -m "Add Intro 2"

Step 4: Choose and Merge Your Favorite Introduction

  • Decide Which Introduction to Use (e.g., Intro 1).

  • Merge Your Chosen Introduction into Main:

    git checkout main
    git merge intro-1

Step 5: Finalize and Share Your Story

  • Push Your Story to GitHub:

    git push origin main
  • Create a Pull Request on GitHub to merge your story into the instructor's repository.

branching-git-story's People

Contributors

castonpursuit avatar markediahinds avatar

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.