Git 명령 참조

일상 사용 가능한 Git 명령어: init, clone, branch, merge, stash 및 remotes.초보자와 가끔 메모리 한 한 한 번의 클릭으로 검색 및 복사하십시오.

개인 정보 보호: 로컬로 처리되고, 결코 업로드하지 않습니다.

↓ 아래의 입력 영역에 결결과를 즉시 볼 수 있습니다.

常用 Git 命令速查; 搜索命令或说明,一键复制。

git init

Initialize a new repository

git clone <url>

Clone a remote repository

git status

Show working tree status

git add <file>

Stage changes

git add .

Stage all changes

git commit -m "msg"

Commit staged changes

git push

Push commits to remote

git pull

Fetch and merge remote changes

git branch

List branches

git branch <name>

Create a branch

git checkout <branch>

Switch branch

git switch <branch>

Switch branch (newer)

git merge <branch>

Merge branch into current

git log --oneline

Compact commit history

git diff

Show unstaged diff

git stash

Stash working changes

git stash pop

Apply latest stash

git remote -v

List remotes

git fetch

Download remote objects

git rebase <branch>

Rebase onto branch

메모

说明

收录日常开发最常用的 Git 子命令; 完整选项见 git help 与官方文档。

일상 사용 가능한 Git 명령어: init, clone, branch, merge, stash 및 remotes.초보자와 가끔 메모리 한 한 한 번의 클릭으로 검색 및 복사하십시오.

빠른 시작

  1. 목록 검색

    매일 주파수에 따라 순서되는 명령어.

  2. 검색

    명령 이름이나 설명에 따라 필터링합니다.

  3. 복사명령

    터미널에 붙여넣습니다.

vs git 도움말

이것은 속임수 시트입니다;전체 옵션과 플래그를 위해 git help <command>를 실행합니다.

일반적인 워크플로우

레포를 복제 하기 시작하십시오. `git clone <url>` 는 원격 코드베이스 전체를 로컬로 복제 합니다.일상 작업 중에 `git checkout -b feature-x` 를 사용하여 새로운 브랜치의 변경 사항을 분리합니다.기능을 완료한 후 `git add로 단계를 변경합니다. `git commit -m "message"` 를 통해 커 ` git commit -m "message"` 를 통해 커 ` `git push origin feature-x` 를 사용하여 브랜치를 푸시합니다.

긴급한 버그의 경우 `git stash` 를 사용하여 일시적으로 약속되지 않은 변경 사항을 저장하고 메인 브랜치로 전환하기 전에 작업 공간을 청소하십시오.합병할 때 `git merge --no-ff` 는 브랜치 역사를 보존하지만 `git mergetool` 로 충돌을 시각적으로 해결할 수 있습니다.정기적으로 `git fetch --prune` 를 실행하여 삭제된 원격 지점의 로컬 refs를 청소합니다.

예제

예제

Input

git stash

Output

Stash working changes

FAQ

고급 명령?

매일 작업에 집중;rebase -i, filter-branch 등에 대한 공식 문서를 참조하십시오.

네트워크가 필요한가요?

아니요. 정적 참조만 있습니다.

.git 디렉토리가 복제 후 누락되는 이유는 무엇입니까?

"--depth=1"을전체 역사를 위해, 이 플래그 없이 리클로인하거나 기존 레포에서 `git fetch --unshallow`를 실행하십시오.