Git常用指令记录(从gitlab新项目中截取)


命令行指令

Git 全局设置

  1. git config --global user.name "用户名字"
  2. git config --global user.email "邮箱地址"

创建新版本库

  1. git clone http://gitlab.xxx.git
  2. cd liuliangji-demo
  3. touch README.md
  4. git add README.md
  5. git commit -m "add README"
  6. git push -u origin master

已存在的文件夹

  1. cd existing_folder
  2. git init
  3. git remote add origin http://gitlab.xxx.git
  4. git add .
  5. git commit -m "Initial commit"
  6. git push -u origin master

已存在的 Git 版本库

  1. cd existing_repo
  2. git remote rename origin old-origin
  3. git remote add origin http://gitlab.xxx.git
  4. git push -u origin --all
  5. git push -u origin --tags

查看当前所在分支

  1. git branch

切换分支(分支名,文件名)

  1. git checkout .

BLOG

搜索文章