Skip to content

git小记 #3

@polunzh

Description

@polunzh

git小记


命令:

配置命令别名:

git config --system alias.{short name} {origin name}

列出所有别名配置:

git config --get-regexp alias

打标签:

  • 轻量级标签 git tag {tagname}
  • 含附注标签 git tag -a {tagname} -m {annotation}
  • 推送分支 git push origin {tagname}
  • 推送所有分支 git push origin --tags

重命名分支:

  • 命名任何一个分支 git branch -m {oldname} {newname}
  • 命名当前分支 git branch -m {newname}

删除文件:

  • 从仓库中以及从文件系统中删除文件: git rm {file name}
  • 仅从仓库中删除文件: git rm --cached {file name}

删除远程不存在的本地分支引用:

git fetch -p

合并最近n次提交:

git rebase --interactive HEAD~n
http://stackoverflow.com/questions/2563632/how-can-i-merge-two-commits-into-one

配置相关

  • 列出所有别名: git config --get-regexp alias

问题

  1. git status 乱码 git config --global core.quotepath false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions