GIT

2019-03-22  本文已影响0人  终极蚂蚁

git

开发时,对于本地的项目中修改不做保存操作(或代码改崩),可以用到Git pull的强制覆盖,具体代码如下:

git fetch --all
git reset --hard origin/master
git pull //可以省略

git fetch 指令是下载远程仓库最新内容,不做合并
git reset 指令把HEAD指向master最新版本

git 创建git仓库到指定目录

mayn@DESKTOP-L7PRRDN MINGW64 ~/Desktop/test_git
$ git init repo
Initialized empty Git repository in C:/Users/mayn/Desktop/test_git/repo/.git/

mayn@DESKTOP-L7PRRDN MINGW64 ~/Desktop/test_git
$

git clone 代码到当前目录以... 命名文件夹

mayn@DESKTOP-L7PRRDN MINGW64 ~/Desktop/test_git
$ git clone https://gitee.com/guo_fei/gf_learn.git learn
Cloning into 'learn'...
remote: Enumerating objects: 837, done.
remote: Counting objects: 100% (837/837), done.
remote: Compressing objects: 100% (676/676), done.
remote: Total 837 (delta 337), reused 119 (delta 56)0 KiB/s
Receiving objects: 100% (837/837), 26.52 MiB | 315.00 KiB/s, done.
Resolving deltas: 100% (337/337), done.

mayn@DESKTOP-L7PRRDN MINGW64 ~/Desktop/test_git
$

查看git状态

mayn@DESKTOP-L7PRRDN MINGW64 ~/Desktop/test_git/learn (test)
$ git status
On branch test
Your branch is ahead of 'origin/test' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
上一篇 下一篇

猜你喜欢

热点阅读