git log에서 커밋했던 이력을 확인한 후에
git log
해당파일을 올린 상태로 커밋했던 내역을 하고
git reset --mixed HEAD^ // 1개의 이력 삭제
git reset --mixed HEAD~5 // 5개의 이력 삭제
다시 커밋하면 된다.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Type
feat - a new feature is introduced with the changesfix - a bug fix has occuredchore - changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies)refactor – refactored code that neither fixes a bug nor adds a featuredocs - updates to documentation such as a the README or other markdown filesstyle - changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so ontest - including new or correcting previous testsperf - performance improvementsci – continuous integration relatedbuild - changes that affect the build system or external dependenciesrevert – reverts a previous commitRules
!를 붙이면 major한 change로 본다. (ex: feat!:~ )ex)
fix: prevent racing of requests
Introduce a request id and a reference to latest request. Dismiss
incoming responses other than from latest request.
Remove timeouts which were used to mitigate the racing issue but are
obsolete now.
Reviewed-by: Z
Refs: #123
git commit -am “message’ # 한 번 커밋한 파일만 가능!
git commit —-amend
git restore <file>
git restore —-staged <file>
git add <file> 을 취소하고 싶을 때git reset HEAD^
--soft : 최근 커밋을 하기 전 상태로 되돌리기—mixed : 최근 커밋 + 스테이징 전으로 되돌리기 (default)—hard : 최근 커밋 + 스테이징 + 파일 수정 전으로 되돌리기git reset HEAD~3 : 최근 3개의 커밋 취소git reset <커밋 해시>: 특정 커밋 버전으로 되돌리기git revert <커밋 해시>
git log --oneline --branches
**git log --oneline --branches --graph** * e6c5301 apple content 4
| * 44adcd0 master content 4
|/
* 65220d9 work 3
* 89df040 work 2
* 0d24307 work 1git log master..apple
commit e6c53017db251a0f291ed922918f51d94a263f29
Author: younghoon-j <younghoon.j@navercorp.com>
Date: Fri Apr 28 11:59:46 2023 +0900
apple content 4git init manual-2
mkdir manual-2 + git initgit merge o2 —no-edit
git stash
git stash pop: 꺼내오기git stash apply: 현재 수정하던 내용은 그대로 둔 채 가져오기git stash drop: 목록에서 가장 최근 항목 삭제git remote add origin <http/ssh>
git remote -v 연결된 저장소 확인git push -u origin main
-u 옵션은 둘을 연결하기 위한 것으로 처음에 한번만 사용하면 됨git fetch
git fetch origin <remote_branch>로 새로 만들어진 원격 브랜치를 가져올 수 있음git checkout FETCH_HEAD: fetch로 가져온 원격 브랜치로 이동해서 수정사항을 확인