cd ~/.ssh ssh-keygen -t rsa -C "your_email@youremail.com" # Creates a new ssh key using the provided email
# Generating public/private rsa key pair. # Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
#Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again] #然后应该类似: #Your identification has been saved in /Users/you/.ssh/id_rsa. # Your public key has been saved in /Users/you/.ssh/id_rsa.pub. # The key fingerprint is: #01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com
git config credential.helper store #缓存到文件中,永久储存 git config credential.helper cache # linux 缓存到内存中 git config --global credential.helper wincred# windows 缓存到内存中,需要安装https://github.com/Microsoft/Git-Credential-Manager-for-Windows git config --global credential.helper osxkeychain # mac 缓存到keychain中 git config --global credential.helper osxkeychain #linux mac windows都可以添加global参数 git config credential.helper 'cache --timeout=3600'#数字为保存的时间(秒,默认900) 在这个时间内输入的密码都是有效的,
12.丢弃本地修改
1
git checkout . && git clean -xdf
13. 把其他分支切换为master分支
1
git push origin +dev:master
1 2 3 4 5 6 7 8 9 10
Update the origin repository’s master branch with the dev branch, allowing non-fast-forward updates. This can leave unreferenced commits dangling in the origin repository. Consider the following situation, where a fast-forward is not possible:
o---o---o---A---B origin/master \ X---Y---Z dev The above command would change the origin repository to
[alias] lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit last = log -1 co = checkout ci = commit br = branch st = status