Git 仓库常用操作

来源:互联网 发布:网络主播网站排行榜 编辑:程序博客网 时间:2024/05/29 11:56

1.从git仓库获取代码

git clone ssh://

2.git branch

git branch -a 查看有哪些分支
git checkout SyncProction 切换至分支SyncProction
git branch 查看目前在哪个分支上
git config --global core.autocrlf false

在使用Git的过程中,有些时候我们只想要git服务器中的最新版本的项目,对于本地的项目中修改不做任何理会,就需要用到Git pull的强制覆盖,具体代码如下:
[root@ip-100-00-00-21 ~]# git fetch --all[root@ip-100-00-00-21 ~]# git reset --hard origin/master[root@ip-100-00-00-21 ~]# git pull

上传文件至远程仓库:

首先从Git clone仓库,再本地仓库目录新建文件夹,放入要上传的文件

git add 文件名

git commit -m “描述”

git push origin master

0 0