git commands

作者: 于恺雯 | 来源:发表于2017-06-12 23:36 被阅读0次

1. To see the URL of local repository

git remote show origin

2. View current remote

git remote -v

3. Remove remote

git remote rm <remote_name>

4. git Undo 回滚

详情请见: How to with Git: Undo Command

我一不小心把代码都删了,然后push了一下;结果不仅本地仓库,远端仓库代码都没了,最新的commit就是删除所有代码的commit。但是,上一条commit是上传完整代码的commit,所以我要回滚到上一条commit。

STEPs:

1. 找出正确的,想要回滚回去的commit

git log

2. 当前本地状态为之前递交这个commit前的状态,不要忘记最后那个点

git checkout <commit_Id> .

3. 因为是递交这个commit前的状态,所以查看git status可以看见所有没有commit 的文件

git status

4. git reset回滚回正确的commit,然后用ls查看,文件回到本地,而且GitHub远端仓库文件也回来了

git reset <commit_ID>

ls

相关文章

  • git help

    These are common Git commands used in various situations:...

  • Git Commands

    Clone 1. git clone 2.Check the remote repo...

  • git commands

    1. To see the URL of local repository git remote show ori...

  • git: commands

    …or create a new repository on the command line echo "# g...

  • git commands

    暂存区和分支都属于版本库,修改的地方是工作区。 创建目录:mkdir dir_name显示当前目录:pwd初始化库...

  • Git笔记

    Git Commands tips:<*> means required,[*] means optional 基...

  • 记不住git命令?试试这个命令浏览网站

    Find the right git commands without digging through the w...

  • Basic Git commands

    To use Git, developers use specific commands to copy, cre...

  • A Cup of Git Latte

    Quick reference for some frequently used Git commands. Se...

  • git cmd

    GitHub Commands git 常用命令 注册 SSH key 以便git bash 可以push req...

网友评论

    本文标题:git commands

    本文链接:https://www.haomeiwen.com/subject/ythrqxtx.html