Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git命令使用记录 #17

Open
lazyken opened this issue Oct 16, 2018 · 0 comments
Open

git命令使用记录 #17

lazyken opened this issue Oct 16, 2018 · 0 comments

Comments

@lazyken
Copy link
Owner

lazyken commented Oct 16, 2018

git remote
查看链接的远程分支,origin即是远程的master分支
git branch
列出本地分支
git branch -a (git branch --all的缩写)
列出所有分支,包括本地和远程分支
git checkout -b 本地分支名称(比如:dev) 远程分支名称(比如:origin/dev)
作用是远程分支切换到origin/dev,并在本地创建dev分支,并切换到的本地dev分支
例子:git checkout -b dev origin/dev

create a new repository on the command line
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https:/yourgithubname/xxx.git(仓库地址)
git push -u origin master

直接 git push -u origin branchname;可以把本地的当前分支push到远程仓库的branchname分支,如果没有branchname分支则会自动新建一个远程分支branchname,并push

push an existing repository from the command line
git remote add origin https:/yourgithubname/xxx.git(仓库地址)
git push -u origin master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant