实用的 Git 命令分享
commit forgotten file
$ git commit -m 'initial commit'
$ git add forgotten_file
$ git commit --amend
revert comit and add to another branch
Imagine you commit file on wrong branch(staging) but not push yet
$ git log --oneline; // find the commit hash is LAST_COMMIT_HASH
$ git checkout dev
$ git cherry branch LAST_COMMIT_HASH
$ git push
$ git checkout staging
$ git revert LAST_COMMIT_HASH
$ git push // the LAST_COMMIT_HASH would be replaced by a newer hash
delete local and remote branch
$ git branch -d staging-backup // local
Deleted branch staging-backup (was c1aabf0).
$ git push --delete origin import // remote
To code.aliyun.com:tsp-fe/tsp-web-fe.git
- [deleted] import
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
上一篇: 常用的 bash 命令
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论