我正在学校的计算机上编写一个简单的脚本,并将更改提交给Git(在我的pendrive中的repo中,从我家里的计算机克隆).几次提交后,我意识到我正在以root用户身份提交东西.
有没有办法将这些提交的作者改成我的名字?
我在Git中做了一系列提交,现在我意识到我忘记了正确设置我的用户名和用户邮件属性(新机器).我还没有将这些提交推送到我的存储库,所以在我这样做之前如何更正这些提交(只有主分支上的3个最新提交)?
我一直在看git reset和git commit -C <id> --reset-author,但我不认为我是在正确的轨道上.
如何获取作者对git repo的最新提交的名称?
#!/bin/bash
git_log=`git ls-remote git url master`
git_commitId = git_log | cut -d " " -f1
echo $git_commitId
cd /workspace
git_log_verify = `git rev-parse HEAD`
echo $git_log_verify
if $git_commitId =$git_log_verify then
cd /workspace
git_authorName=`git log --pretty=format:"%an"`;
echo $git_authorName
fi
Run Code Online (Sandbox Code Playgroud)