Code Monkey home page Code Monkey logo

git-practice's Introduction

git-practice

Git Practice repository
All content is taken from https://github.com/github/docs.
Fork this repository and practice!

GIT PRACTICE

1. Pull Request without conflict

[modify_about_merge] -> [pr_branch]

2. Link issue within a commit message

  • Settings - Features - Issues
  • Make "New issue" at Issues
$ git checkout -b issue_test
$ git add .
$ git commit -m "test issue #1"
$ git push origin issue_test

3. Pull Request with conflict (resolve with web editor)

[conflict_branch] -> [modify_about_merge]

4. Pull Request with conflict (resolve with command line)

[conflict_branch2] -> [modify_about_merge]

$ git checkout -b conflict_branch2 origin/conflict_branch2
$ git merge modify_about_merge
# conflict resolve
$ git add .
$ git commit -m "conflict resolve"
$ git push origin conflict_branch2

5. Sqaush practice (with web editor)

[squash_branch] -> [pr_branch]

6. Squash practice (with command line)

[squash_branch2] -> [pr_branch]

image

$ git checkout -b squash_branch2 origin/squash_branch2
$ git log --pretty=oneline # check commit history
$ git rebase -i a5909f529078f558156297977d851d1d458fd233
pick 166267a squash commit 1
s f93aa5b squash commit 2
s 5a9ad96 squash commit 3
s 5d2909a squash commit 4
s d86c1a8 squash commit 5
$ git log --pretty=oneline  # check squash result
a3ae723519d4c38b49c7f4189e87152ec4f4067a (HEAD -> squash_branch2) squash commit 1~5
a5909f529078f558156297977d851d1d458fd233 (master) add github contents
f20a4725e5374c6d7cb6b4a50d97d008fdd98aca Initial commit
$ git push -f origin squash_branch2

7. Commit amend practice

$ git checkout -b amend_branch
# modify configuring-commit-rebasing-for-pull-requests.md file
$ git add .
$ git commit -m "amend commit"
# modify README.md
$ git add .
$ git commit --amend
$ git push origin amend_branch

Useful git commands

1. Git pull all from remote

$ git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
$ git fetch --all
$ git pull --all

git-practice's People

Contributors

yeonns avatar

git-practice's Issues

sample issue

사용 환경, 이슈 발생 상황 등 자세하게,,,
pr 날리는 이유를 issue 를 Linking
written for pr linking

(##)하면 description 형식으루

// Markdown 문법

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.