git克隆;上传;合并


1>克隆

git config --global user.name "hahaha"
git config --global user.email "[email protected]"
1. 在本地创建文件夹D/test
2. git打开到本地文件夹下

cd d:

cd test

3.新建一个testgit版本库

mkdir testgit

cd testgit
4. git clone  http://[email protected] (要用自己的)
5. 打开库:cd ha
6. 查看<远程>所有分支:git branch -r 
7. git checkout --track origin/×××(想要的分支名)

8.如果想取任一历史版本,操作如下:

打开库:cd ha

git clone(然后找到指定的版本)

git checkout fd009208(fd009208为commit的前8位),完成。


2>上传

git config --global user.name "abc"
git config --global user.email "[email protected]"
//1. git init
2. git add .     (查看状态git status)
3. git commit -m"我有一只小毛驴"    ------以上3步只是本地提交
4.git remote rm origin
   git remote add origin  http://[email protected]
5.git push origin ××××(×为分支名)


3>合并

//把A合并到B
1.在B分支下,git merge A
2.手动解决冲突:git add 1.cpp
                               git add 2cpp
3.git commit -m"合并A"

4.git remote rm origin
   git remote add origin  http://[email protected]
5.git push origin ××××(×为分支名)


发布了35 篇原创文章 · 获赞 17 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/shaopengf/article/details/50475325