git 매일 쓰는 명령어

  • durecat
    (durecat)
  • durecat's Avatar 이 글의 작성자
  • Offline
  • Newbie
  • Newbie
더보기
09 Feb 2019 01:10 #4431 작성자: durecat
durecat 님의 글: git 매일 쓰는 명령어
1. 현재 상태 확인
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   routes/web.php

no changes added to commit (use "git add" and/or "git commit -a")
/usr/local/var/www/ckmotors $ gitst
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	resources/views/test.blade.php

nothing added to commit but untracked files present (use "git add" to track)


2. 변경사항 취소
$ git checkout {filename}

3. Add
새로운 파일이 있는 경우 add 를 먼저 해야 commit 을 할 수 있습니다. git add {filename} 으로 개별 추가 하거나 -A 옵션을 사용하여 한번에 모두 추가 합니다
$ git add {filename}
$ git add -A

4. commit
-a 는 add, -m 옵션은 메세지를 입력하는 것입니다. 새로운 파일이 있는 경우 git add로 추가를 해야 커밋 할 수 있습니다.
$ git commit -am "test"

5. Push
$ git push origin master

6. Log 확인
$ git log --pretty=oneline --abbrev-commit --graph
* 88c5acf (origin/master, origin/HEAD) fixed errors and modified some sources for production
* 45c9aaa fixed showing checklists categories by default
* 847e53c fixed linking a customer

저는 보통 쉘 프로파일에 아래 처럼 alias 걸어서 사용합니다.
alias gitlog='git log --pretty=oneline --abbrev-commit --graph'
alias gitpush='git push origin master'
alias gitst='git status'
좋아요를 누른 살쾡이: hotrod
Time to create page: 0.054 seconds
Powered by Kunena Forum