Android Studio中的git rebase命令

时间:2019-06-23 18:07:04

标签: git rebase

我正在尝试在 Android Studio 终端中编辑提交者的作者姓名:

> git log

D:\Users\me\AndroidStudioProjects\ex4_android_fly>git log
commit e4877c673dc89a716c964ea958355573f789628e (HEAD -> master)
Merge: 99849c3 fd3eab5
Author: Devy <devy-example@gmail.com>
Date:   Sun Jun 23 20:57:49 2019 +0300

> git rebase -i e4877c673dc89a716c964ea958355573f789628e

noop

# Rebase e4877c6..99849c3 onto e4877c6 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# .       create a merge commit using the original merge commit's
# .       message (or the oneline, if no original merge commit was
# .       specified). Use -c <commit> to reword the commit message.

所有这些最后的文本现在显示在终端中,我不知道该怎么办,我想执行命令git commit --amend --author="Author Name <email@address.com>"

我的意思是,我似乎被这条短信所困扰,不知道如何执行下一个git命令。

2 个答案:

答案 0 :(得分:0)

您正在使用git rebase命令(-i)的交互模式。

只需按Ctrl + C,然后执行下一条命令即可。

答案 1 :(得分:0)

如果您想在上一次提交时更改作者,可以使用: git commit --amend --author="Author Name <email@address.com>"

否则,您应该使用: git rebase -i origin/master

在rebase列表中,对于要更改的每个提交,将“ pick”替换为“ edit”(或“ e”)。

Git将重新设置基准,在您标记的每个提交处停止。现在对您标记的每个提交执行此操作:

  • git commit --amend --author =“作者姓名”
  • git rebase --continue