Giter VIP home page Giter VIP logo

git-guide's Introduction

Git Guide

git을 사용하면서 자주 사용하는 명령어를 정리. (맨날 까먹고 검색하는 나를 위해서)


기본설정

git init

$ git init

최초로 git 설정을 할 때 사용하는 명령어로, .git 폴더가 생성된다. .git 폴더는 숨겨져 있음. 이 폴더를 지우면 모든 것이 사라진다. 만약에 그동안 관리한걸 다 날리고 싶으면 쿨하게 삭제하면 된다.

git status

$ git status

현재 폴더의 상태를 나타내주는 명령어. add나 commit 되지 않은 파일 등을 표시해주고, 커밋 상태 등 여러 가지 정보를 보여준다. 종종 사용함.

git config

$ git config --global user.name "cutelee"
$ git config --global user.email "[email protected]"

git config에 --system 옵션을 주면 /etc/gitconfig 파일을 찾으며, 이 파일의 설정은 모든 사용자와 모든 저장소에 적용된다. --global 옵션을 주면 ~/.gitconfig 파일을 찾으며 이 설정은 해당 저장소에만 적용되는 설정이다. 설정파일을 직접 수정해도 되지만, git config 명령어를 사용하는 것이 더 편리.


Commit

$ git commit -m "[contents]"

현재 add된 파일들을 커밋해주며, contents에는 커밋메세지를 작성하면 된다.


원격 저장소

git clone

$ git clone [원격저장소 주소]

해당 원격저장소 주소의 파일을 받아오는 명령어.

git remote

$ git remote -v

단축이름, 연결된 원격저장소 url을 보여주는 명령어. -v 옵션이 없으면 단축이름만 알려준다.

$ git remote add [name] [url]

name으로 단축이름을 설정하고, url을 연결해주는 명령어.

$ git remote set-url [name] [url]

name에 연결된 url을 url로 바꿔주는 명령어.

git push

$ git push [name] master

name에 연결되어 있는 원격저장소로 현재 상태를 전송해주는 명령어.


.gitignore 설정법

.gitignore 파일 설정을 통해 git이 관리하지 않아도 될 파일 혹은 디렉토리의 정보를 설정해줄 수 있다. 개발 과정에서 부산물로 생기는 임시 파일(프로젝트 설정파일, 빌드 과정에서 생기는 오브젝트 파일 등)들의 경우 추적이 필요 없으므로 .gitignore를 통해서 무시하도록 설정할 수 있다.

무시하고자 하는 폴더/파일 이름을 입력하면 된다. / 표시가 붙은 경우는 하위의 모든 내용을 무시하겠다는 의미.


git-guide's People

Contributors

devsoyoung avatar cutelee avatar

Watchers

James Cloos 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.