여기서 Add payment library and Add payment service라는
commit을 2개로 나누기로 하였다고 가정하자.
git rebase -i [이전의 해시코드]
여기서 commit을 edit하고 싶은 것이므로
edit으로 바꾸고 저장한다.
저장하고 git hist를 확인해보면 HEAD가 바뀌어 있는 것을
확인할 수 있다.git hist
특정한 commit을 초기화 시켜주는 reset 명령어 사용
HEAD로부터 이전의 commit부터 선택해야함git reset HEAD~1
working directory로 옮겨진 것을 확인할 수 있다.
package.json 파일과
payment-service.txt 파일이 있다.git status
이 파일을 하나씩 staging area로 보내고 commit을 해주면 된다.
git add package.json
git commit -m "Add payment library"
새로 생성되고 HEAD가 된 것을 확인할 수 있다.
git add payment-service.txt git commit -m "Add payment service"
마지막으로 rebase를 계속해준다.
git rebase --continue
Add payment service commit과
Add payment library commit이 생성된다.