'每次提交都要手动输入用户名和密码,若想避免这些麻烦,可以在系统中创建 SSH 公私钥,
并将公钥放到 GitHub 指定位置。如此操作即可生成 GitHub 账户对于当前系统中的 Git 授权。'
ssh-keygen
tree ~/.ssh
'为 Git 命令设置别名'
git config --global alias.[别名] [原命令]
git config --global alias.st status
git config --global alias.br 'branch -avv'
git config --global alias.com 'commit -m'
cat -n ~/.gitconfig
git config -l
'将远程仓库的分支信息拉取到本地仓库'
git fetch
`注意,仅仅是更新了本地的远程分支信息,也就是执行 git branch -avv 命令时,查看到的 remotes 开头的行的分支信息。
fetch 命令的作用是刷新保存在本地仓库的远程分支信息,此命令需要联网。`
'此时若想使本地 master 分支的提交版本为最新'
git pull
'使本地 master 分支基于远程仓库的 master 分支'
git rebase origin/master
'创建新的分支:'
git branch [分支名]
git branch dev