Git常用的命令

Git命令

Git global setup

git config --global user.name "xxx"

git config --global user.email "xxx"

Create a new repository

git clone [email protected]:houhongxu/test.git

cd test

touch README.md

git add README.md

git commit -m "add README"

git push -u origin master

Existing folder or Git repository

cd existing_folder

git init

git remote add origin [email protected]:JZMobile/Moocnd-in-Android.git

git push -u origin master

本地代码从一个git 地址切到另一个git

git remote -v

git remote rm origin

git remote add origin [email protected]:JZMobile/MoocXuetang.git

git fetch

git push origin feature-new-dev

从一个git仓库迁移到另一个git仓库

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done

git fetch --all

git pull --all

git remote -v

git remote rm origin

git remote add origin [email protected]:JZMobile/MoocXuetang.git

git push -u origin --all

git push -u origin --tags

回退版本

git reset --hard 29da412f1676b13bebb95ba1228299ed71e3bec9

git push -f -u origin feature-dev


------------------

将本地文件提交到github

https://www.jianshu.com/writer#/notebooks/6402425/notes/96401700

查看远端分支

git branch -r

查看当前分支

git branch

你可能感兴趣的:(Git常用的命令)