Git-flow常用命令

Version: git version 2.14.3 (Apple Git-98)

分支(branch)

  git checkout -B branch_name // 本地创建分支,并切换到该分分支
  git push origin --delete branch_name  //删除远程分支
  git fetch -p // 获取远程更新,并且删除已经不在远程存在的分支
  git branch -D branch_name  // 删除本地分支

Tag

terminal: git tag 1.1.1                 // 创建一个新的tag,为 1.1.1     
terminal: git push origin --tags        // 将本地的tag推送到远程
terminal: git tag -d 1.1.1              //删除本地名为1.1.1的tag
terminal: git push origin --delete tag 1.1.1  //删除远程tag 1.1.1

设置多个Gitconfig的user和email

我们平常开发中,在公司使用的是公司的账号和用户名, 我们发布Code到我们自己的Github上需要切换到自己的账号和用户名, 如何区分使用?
全局: git config

git config --global user.name "Your Name Here"
git config --global user.email [email protected]

单个工程: 在需要使用其他账号和邮箱的项目目录中, 单独为当前设置账户和邮箱

git config user.name "Your Name Here"
git config user.email [email protected]

git修改已提交commit的author

https://makandracards.com/makandra/1717-git-change-author-of-a-commit

Q:丢弃所有 untracked files?

   git clean -f

Q:git修改已提交commit的author

git commit --amend -m "Inital init" --author="mistdon "

A: git-change-author-of-a-commit

Reference:

  • Git

  • 删除远程错误提交的commit

  • githowto

  • 如何同步fork出来的代码

  • 更改指定commit的信息(作者名)

  • how-to-merge-specific-files-from-another-branch

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