git修改作者信息(提交者信息异常)

最近公司换了之前离职同事的电脑,在idea上将git的账号和密码都改掉了,但是提交发现作者信息还是有问题,是之前同事的账号和邮箱

一. 修改以后提交的作者信息

1. 通过下列进程查看git的配置

git config --list

看到username和email都不是自己的

2. 通过下列命令修改作者信息

git config --global user.name "作者"

git config --global user.email "邮箱"

二. 修改已经提交了的作者信息

现在是完成了以后修改的任务,那么之前已经push了的应该如何更改合作者。分为两种情况

  1. 修改第一条记录
       1、修改本地记录:git commit --amend --author=""
    
       2、获取远程信息 git fetch
    
       3、推送修改 git push --force-with-lease

     

  2. 修改第n条记录 
       1、git rebase -i commit_id(第N+1条记录的commitId)
    
       2、git commit --amend --author="...." (修改信息,则 git commit --amend, 然后Enter 保存)
    
       3、git rebase --continue
    
       4、git fetch
    
       5、git push --force-with-lease

     

 

 

 

 

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在前端form中,可以通过JavaScript来实现在密码和确认密码不一致时不提交表单的操作。 可以给确认密码输入框添加一个事件监听器,当确认密码的值改变时,就判断密码和确认密码的值是否相同,如果不同则禁止表单提交。以下是一个示例代码: ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>注册</title> </head> <body> <h2>注册</h2> <form onsubmit="return validateForm()"> <label for="username">用户名</label> <input type="text" id="username"> <label for="password">密码</label> <input type="password" id="password"> <label for="confirm_password">确认密码</label> <input type="password" id="confirm_password" oninput="checkPassword()"> <button type="submit">注册</button> </form> <script> function checkPassword() { var password = document.getElementById("password").value; var confirm_password = document.getElementById("confirm_password").value; if (password !== confirm_password) { document.getElementById("confirm_password").setCustomValidity("密码和确认密码不一致"); } else { document.getElementById("confirm_password").setCustomValidity(""); } } function validateForm() { var password = document.getElementById("password").value; var confirm_password = document.getElementById("confirm_password").value; if (password !== confirm_password) { document.getElementById("confirm_password").setCustomValidity("密码和确认密码不一致"); return false; } else { document.getElementById("confirm_password").setCustomValidity(""); return true; } } </script> </body> </html> ``` 这段代码中,`checkPassword()`函数会在确认密码输入框的值改变时调用,判断密码和确认密码的值是否相同,如果不同则设置确认密码输入框的`setCustomValidity`属性为一个错误提示信息。`validateForm()`函数会在表单提交时调用,判断密码和确认密码的值是否相同,如果不同则设置确认密码输入框的`setCustomValidity`属性为一个错误提示信息,并返回`false`阻止表单提交,否则返回`true`允许表单提交

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值