Skip to content

Instantly share code, notes, and snippets.

@dalinaum
Last active August 10, 2022 15:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalinaum/09aa4b1bc0f378de1d279ab3156f60b6 to your computer and use it in GitHub Desktop.
Save dalinaum/09aa4b1bc0f378de1d279ab3156f60b6 to your computer and use it in GitHub Desktop.
스쿼시, 머지 가이드

머지 제거

git log를 봤을 때 마지막에 마스터를 머지했네요.

commit 449ce0b2929cddd7cf760f63d4e07dc25d574abd (HEAD -> patch-1, danuel/patch-1)
Merge: 8fea8a6c1fc 66eb9821666
Author: Danuel <public.danuel@gmail.com>
Date:   Mon Jan 18 23:50:41 2021 +0900

    Merge branch 'master' into patch-1

Merge에 커밋이 두개가 보이는데 전자인 8fea8a6c1fc로 이동하고 후자인 66eb9821666를 버리면 머지로부터 자유로운 것 같습니다.

머지를 제거합시다. 마지막에 리베이스 할거니 지금은 필요없어요.

git reset --hard 8fea8a6c1fc

squash

squah를 합시다.

commit b301ce504e6c3ae309c91a736a2bb49b39987fb2
Author: Danuel <public.danuel@gmail.com>
Date:   Sun Jan 3 00:12:29 2021 +0900

    Add visitors for checking #[inline] with struct field

commit f6b6d5cf6486926a1c8dffe4ef793e214cb827c5
Merge: 0876f59b975 72a7f736106
Author: bors <bors@rust-lang.org>
Date:   Sat Jan 2 04:12:48 2021 +0000

    Auto merge of #79870 - sharnoff:smart-pointer-Any-type_id, r=shepmaster

    Add docs note about `Any::type_id` on smart pointers

Danuel이 처음으로 작업한 커밋이 borsf6b6d5cf6486926a1c8dffe4ef793e214cb827c5 커밋 다음이네요. 여길 기준으로 스쿼시를 하면 됩니다.

git rebase -i f6b6d5cf6486926a1c8dffe4ef793e214cb827c5

아래와 같이 나올겁니다. 겁먹지 마세요.

pick b301ce504e6 Add visitors for checking #[inline] with struct field
pick 4efaf3e1430 Fix test for #[inline]
pick b164669a5ea Add visitors for checking #[inline] with #[macro_export] macro
pick be7ab2fd4d9 Add visitors for checking #[inline] without #[macro_export] macro
pick ef2710c4e67 Add use alias with Visitor
pick 80eaa18fe13 Fix lint error
pick 056a5d1820c Reduce unnecessary variable
pick b3e39da0bc1 Change error to warning
pick e31dcac681f Add warning for checking field, arm with #[allow_internal_unstable]
pick df8192e75b9 Add name resolver
pick 9506e0e3019 Formatting
pick 861e00bc80f Formatting
pick efca9ed8d5b Fix error fixture
pick 8fea8a6c1fc Add checking field, arm, macro def

첫 번째 커밋만 pick을 하고 나머지는 모두 squash 혹은 s로 바꿉시다.

pick b301ce504e6 Add visitors for checking #[inline] with struct field
s 4efaf3e1430 Fix test for #[inline]
s b164669a5ea Add visitors for checking #[inline] with #[macro_export] macro
s be7ab2fd4d9 Add visitors for checking #[inline] without #[macro_export] macro
s ef2710c4e67 Add use alias with Visitor
s 80eaa18fe13 Fix lint error
s 056a5d1820c Reduce unnecessary variable
s b3e39da0bc1 Change error to warning
s e31dcac681f Add warning for checking field, arm with #[allow_internal_unstable]
s df8192e75b9 Add name resolver
s 9506e0e3019 Formatting
s 861e00bc80f Formatting
s efca9ed8d5b Fix error fixture
s 8fea8a6c1fc Add checking field, arm, macro def

이제 커밋 메시지를 에디트합시다.

# 커밋 14개가 섞인 결과입니다.
# 1번째 커밋 메시지입니다:

Add visitors for checking #[inline] with struct field

# 커밋 메시지 #2번입니다:

Fix test for #[inline]

# 커밋 메시지 #3번입니다:

Add visitors for checking #[inline] with #[macro_export] macro

# 커밋 메시지 #4번입니다:
...

제일 위에 제목을 새로 정하는 것이 좋겠습니다. 주석 위에 예를 들어 Add visitors for checking #[inline]같은 것을 넣읍시다.

아니면 완전히 지우고 새로 커밋 메시지를 적어도 좋습니다.

그럼 이제 스쿼시가 완료되었습니다.

origin/master에 리베이스

이제 master를 가져와서 리베이스 합시다.

git rebase origin/master

충돌이 발생합니다. git status로 보니 src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr에서 충돌이 났네요.

src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr 수정하고 다음의 커맨드를 진행합시다.

git add src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr
git rebase --continue

리베이스가 완료될 겁니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment