Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions docs/ko/reference/Commit/Methods/amend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# amend

입력한 값을 사용해서 이 기존 커밋을 수정해요

이 메서드는 기존 커밋과 완전히 동일하지만 값들이 업데이트된 새 커밋을 만들어요. 새 커밋은 이전 커밋과 동일한 부모를 가져요.

## 시그니처

```ts
class Commit {
amend(options?: AmendOptions, tree?: Tree): string;
}
```

### 파라미터

<ul class="param-ul">
<li class="param-li param-li-root">
<span class="param-name">options</span><span class="param-type">null | AmendOptions</span>
<br>
<p class="param-description">커밋을 수정하기 위한 옵션이에요.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">author</span><span class="param-type">SignaturePayload</span>
<br>
<p class="param-description">작성자 서명이에요.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">email</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">서명에 사용되는 이메일이에요.</p>
</li>
<li class="param-li">
<span class="param-name">name</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">서명에 사용되는 이름이에요.</p>
</li>
<li class="param-li">
<span class="param-name">timeOptions</span><span class="param-type">SignatureTimeOptions</span>
<br>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">offset</span><span class="param-type">number</span>
<br>
<p class="param-description">시간대 오프셋(분 단위)이에요.</p>
</li>
<li class="param-li">
<span class="param-name">timestamp</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">number</span>
<br>
<p class="param-description">에포크부터의 시간(초 단위)이에요.</p>
</li>
</ul>
</li>
</ul>
</li>
<li class="param-li">
<span class="param-name">committer</span><span class="param-type">SignaturePayload</span>
<br>
<p class="param-description">커미터 서명이에요.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">email</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">서명에 사용되는 이메일이에요.</p>
</li>
<li class="param-li">
<span class="param-name">name</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">서명에 사용되는 이름이에요.</p>
</li>
<li class="param-li">
<span class="param-name">timeOptions</span><span class="param-type">SignatureTimeOptions</span>
<br>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">offset</span><span class="param-type">number</span>
<br>
<p class="param-description">시간대 오프셋(분 단위)이에요.</p>
</li>
<li class="param-li">
<span class="param-name">timestamp</span><span class="param-required">필수</span>&nbsp;·&nbsp;<span class="param-type">number</span>
<br>
<p class="param-description">에포크부터의 시간(초 단위)이에요.</p>
</li>
</ul>
</li>
</ul>
</li>
<li class="param-li">
<span class="param-name">message</span><span class="param-type">string</span>
<br>
<p class="param-description">이 커밋의 전체 메시지에요.</p>
</li>
<li class="param-li">
<span class="param-name">messageEncoding</span><span class="param-type">string</span>
<br>
<p class="param-description">커밋 메시지에 사용할 인코딩이에요. 표준 인코딩 이름으로 표현해요. 예: &quot;UTF-8&quot;이에요. NULL이면 인코딩 헤더를 쓰지 않고 UTF-8로 간주해요.</p>
</li>
<li class="param-li">
<span class="param-name">updateRef</span><span class="param-type">string</span>
<br>
<p class="param-description">NULL이 아니면 이 커밋을 가리키도록 업데이트할 참조 이름이에요. 참조가 직접 참조가 아니면 직접 참조로 해석돼요. 현재 브랜치의 HEAD를 이 커밋을 가리키도록 업데이트하려면 &quot;HEAD&quot;를 사용해요. 참조가 아직 없으면 새로 만들어지고, 이미 있으면 이 브랜치의 최신 커밋이 첫 번째 부모여야 해요.</p>
</li>
</ul>
</li>
<li class="param-li param-li-root">
<span class="param-name">tree</span><span class="param-type">null | Tree</span>
<br>
<p class="param-description">커밋을 수정할 때 사용할 트리예요.</p>
</li>
</ul>

### 반환 값

<ul class="param-ul">
<li class="param-li param-li-root">
<span class="param-type">string</span>
<br>
<p class="param-description">수정된 커밋의 ID(SHA1)예요.</p>
</li>
</ul>
123 changes: 123 additions & 0 deletions docs/reference/Commit/Methods/amend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# amend

Amend this existing commit with all non-nullable values

This creates a new commit that is exactly the same as the old commit,
except that any non-nullable values will be updated. The new commit has
the same parents as the old commit.

## Signature

```ts
class Commit {
amend(options?: AmendOptions, tree?: Tree): string;
}
```

### Parameters

<ul class="param-ul">
<li class="param-li param-li-root">
<span class="param-name">options</span><span class="param-type">null | AmendOptions</span>
<br>
<p class="param-description">Options for amending commit.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">author</span><span class="param-type">SignaturePayload</span>
<br>
<p class="param-description">Signature for author.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">email</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">Email on the signature.</p>
</li>
<li class="param-li">
<span class="param-name">name</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">Name on the signature.</p>
</li>
<li class="param-li">
<span class="param-name">timeOptions</span><span class="param-type">SignatureTimeOptions</span>
<br>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">offset</span><span class="param-type">number</span>
<br>
<p class="param-description">Timezone offset, in minutes</p>
</li>
<li class="param-li">
<span class="param-name">timestamp</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">number</span>
<br>
<p class="param-description">Time in seconds, from epoch</p>
</li>
</ul>
</li>
</ul>
</li>
<li class="param-li">
<span class="param-name">committer</span><span class="param-type">SignaturePayload</span>
<br>
<p class="param-description">Signature for committer.</p>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">email</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">Email on the signature.</p>
</li>
<li class="param-li">
<span class="param-name">name</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">string</span>
<br>
<p class="param-description">Name on the signature.</p>
</li>
<li class="param-li">
<span class="param-name">timeOptions</span><span class="param-type">SignatureTimeOptions</span>
<br>
<ul class="param-ul">
<li class="param-li">
<span class="param-name">offset</span><span class="param-type">number</span>
<br>
<p class="param-description">Timezone offset, in minutes</p>
</li>
<li class="param-li">
<span class="param-name">timestamp</span><span class="param-required">required</span>&nbsp;·&nbsp;<span class="param-type">number</span>
<br>
<p class="param-description">Time in seconds, from epoch</p>
</li>
</ul>
</li>
</ul>
</li>
<li class="param-li">
<span class="param-name">message</span><span class="param-type">string</span>
<br>
<p class="param-description">Full message for this commit</p>
</li>
<li class="param-li">
<span class="param-name">messageEncoding</span><span class="param-type">string</span>
<br>
<p class="param-description">The encoding for the message in the commit, represented with a standard encoding name. E.g. &quot;UTF-8&quot;. If NULL, no encoding header is written and UTF-8 is assumed.</p>
</li>
<li class="param-li">
<span class="param-name">updateRef</span><span class="param-type">string</span>
<br>
<p class="param-description">If not NULL, name of the reference that will be updated to point to this commit. If the reference is not direct, it will be resolved to a direct reference. Use &quot;HEAD&quot; to update the HEAD of the current branch and make it point to this commit. If the reference doesn&#39;t exist yet, it will be created. If it does exist, the first parent must be the tip of this branch.</p>
</li>
</ul>
</li>
<li class="param-li param-li-root">
<span class="param-name">tree</span><span class="param-type">null | Tree</span>
<br>
<p class="param-description">Tree to use for amending commit.</p>
</li>
</ul>

### Returns

<ul class="param-ul">
<li class="param-li param-li-root">
<span class="param-type">string</span>
<br>
<p class="param-description">ID(SHA1) of amended commit.</p>
</li>
</ul>
62 changes: 62 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,23 @@ export declare class Commit {
* @returns Commit time of a commit.
*/
time(): Date
/**
* Get the id of the tree pointed to by this commit.
*
* No attempts are made to fetch an object from the ODB.
*
* @category Commit/Methods
*
* @signature
* ```ts
* class Commit {
* treeId(): string;
* }
* ```
*
* @returns Get the id of the tree pointed to by a commit.
*/
treeId(): string
/**
* Get the tree pointed to by a commit.
*
Expand Down Expand Up @@ -577,6 +594,27 @@ export declare class Commit {
* @returns `GitObject` that casted from this commit.
*/
asObject(): GitObject
/**
* Amend this existing commit with all non-nullable values
*
* This creates a new commit that is exactly the same as the old commit,
* except that any non-nullable values will be updated. The new commit has
* the same parents as the old commit.
*
* @category Commit/Methods
*
* @signature
* ```ts
* class Commit {
* amend(options?: AmendOptions, tree?: Tree): string;
* }
* ```
*
* @param {AmendOptions} [options] - Options for amending commit.
* @param {Tree} [tree] - Tree to use for amending commit.
* @returns ID(SHA1) of amended commit.
*/
amend(options?: AmendOptions | undefined | null, tree?: Tree | undefined | null): string
/**
* Get the author of this commit, using the mailmap to map it to the canonical name and email.
*
Expand Down Expand Up @@ -5254,6 +5292,30 @@ export interface AddMailmapEntryData {
replaceEmail: string
}

export interface AmendOptions {
/**
* If not NULL, name of the reference that will be updated to point to this commit.
* If the reference is not direct, it will be resolved to a direct reference.
* Use "HEAD" to update the HEAD of the current branch and make it point to this commit.
*
* If the reference doesn't exist yet, it will be created.
* If it does exist, the first parent must be the tip of this branch.
*/
updateRef?: string
/** Signature for author. */
author?: SignaturePayload
/** Signature for committer. */
committer?: SignaturePayload
/** Full message for this commit */
message?: string
/**
* The encoding for the message in the commit, represented with a standard encoding name.
* E.g. "UTF-8".
* If NULL, no encoding header is written and UTF-8 is assumed.
*/
messageEncoding?: string
}

/**
* - `Unspecified` : Use the setting from the remote's configuration
* - `Auto` : Ask the server for tags pointing to objects we're already downloading
Expand Down
Loading