728x90
반응형
<<< 최초 git push >>>
1. ".git" 폴더 생성
$ git init
2. 파일 변경 상태 확인
$ git status
3. staging area에 추가
$ git add "파일이름" # 특정 파일 add
$ git add . # 폴더 내에 있는 파일 전체 add // 변경된 파일 add
4. commit 및 message 작성
$ git commit -m "commit message"
5. commit 정보 확인 확인
$ git log
6. repository에 코드 push하기
$ git remote add origin "repository_url"
$ git remote -v
$ git push -u origin master
<<< 업로드 관련 >>>
$ git add . # 폴더 내에 있는 파일 전체 add // 변경된 파일 add
$ git commit -m "Commit message" # 명령어
$ git push origin master
# git add 취소 시
$ git reset # 전체 add 취소
$ git rm --cached "파일이름" # 특정 파일 add 취소
# git commit 취소 unstaged 상태로 워킹 디렉터리에 보존
$ git reset HEAD^
$ git reset --mixed HEAD^ # 기본 옵션
# git commit 취소 후 staged 상태로 워킹 디렉터리에 보존
$ git reset --soft HEAD^
# git commit message 변경
$ git commit --amend
<< 다운로드 관련 >>
$ git clone "repository_url" # github 에 등재된 소스 최초 다운
$ git pull origin master # 최초 다운 후, 변경된 버전에 대한 추가 다운
<< Quick setup >>
# …or create a new repository on the command line
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/{...}
git push -u origin main
# …or push an existing repository from the command line
git remote add origin https://github.com/{...}
git branch -M main
git push -u origin main
<< git help >>
$git help
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore working tree files
rm Remove files from the working tree and from the index
sparse-checkout Initialize and modify the sparse-checkout
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
######################################################
$ git add -help
usage: git add [<options>] [--] <pathspec>...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
--renormalize renormalize EOL of tracked files (implies -u)
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add changes from all tracked and untracked files
--ignore-removal ignore paths removed in the working tree (same as --no-all)
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry run
--chmod (+|-)x override the executable bit of the listed files
######################################################
$ git commit -help
usage: git commit [<options>] [--] <pathspec>...
-q, --quiet suppress summary after successful commit
-v, --verbose show diff in commit message template
Commit message options
-F, --file <file> read message from file
--author <author> override author for commit
--date <date> override date for commit
-m, --message <message>
commit message
-c, --reedit-message <commit>
reuse and edit message from specified commit
-C, --reuse-message <commit>
reuse message from specified commit
--fixup <commit> use autosquash formatted message to fixup specified commit
--squash <commit> use autosquash formatted message to squash specified commit
--reset-author the commit is authored by me now (used with -C/-c/--amend)
-s, --signoff add Signed-off-by:
-t, --template <file>
use specified template file
-e, --edit force edit of commit
--cleanup <mode> how to strip spaces and #comments from message
--status include status in commit message template
-S, --gpg-sign[=<key-id>]
GPG sign commit
Commit contents options
-a, --all commit all changed files
-i, --include add specified files to index for commit
--interactive interactively add files
-p, --patch interactively add changes
-o, --only commit only specified files
-n, --no-verify bypass pre-commit and commit-msg hooks
--dry-run show what would be committed
--short show status concisely
--branch show branch information
--ahead-behind compute full ahead/behind values
--porcelain machine-readable output
--long show status in long format (default)
-z, --null terminate entries with NUL
--amend amend previous commit
--no-post-rewrite bypass post-rewrite hook
-u, --untracked-files[=<mode>]
show untracked files, optional modes: all, normal, no. (Default: all)
######################################################
$ git push -help
usage: git push [<options>] [<repository> [<refspec>...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
-d, --delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--force-with-lease[=<refname>:<expect>]
require old value of ref to be at this value
--recurse-submodules[=(check|on-demand|no)]
control recursive pushing of submodules
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack>
receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
--prune prune locally removed refs
--no-verify bypass pre-push hook
--follow-tags push missing but relevant tags
--signed[=(yes|no|if-asked)]
GPG sign the push
--atomic request atomic transaction on remote side
-o, --push-option <server-specific>
option to transmit
-4, --ipv4 use IPv4 addresses only
-6, --ipv6 use IPv6 addresses only
728x90
반응형
'Etc' 카테고리의 다른 글
구글 지도에서 GPS 좌표값 얻는 방법 (0) | 2022.04.12 |
---|---|
맥북 숨긴 파일 보기 단축키 (0) | 2021.07.12 |
맥북에 아이폰 usb 연결 시, 끊김 현상 해결 방법 (0) | 2021.05.28 |
맥북에서 줄바꿈 안될 때 (0) | 2020.10.05 |