Pycharm create new branch and push to Git
1 Create new branch on pycharm locally and push to Git
(lower right corner)
or
Git Bash
git branch xxx
2 Open Git Bash , cd to the folder
14500@oliverzhou MINGW64 ~
$ cd C:\Users\14500\PycharmProjects\test #单\无法正常进入,应像下面\\
bash: cd: C:Users14500PycharmProjectstest: No such file or directo
14500@oliverzhou MINGW64 ~
$ cd C:\\Users\\14500\\PycharmProjects\\test # 使用\\
14500@oliverzhou MINGW64 ~/PycharmProjects/test (slave01) # 正常进入
3 Show all remote repository
git remote -v
4 Show all branch in the repository
git branch -a
git branch
14500@oliverzhou MINGW64 ~/PycharmProjects/test (slave01)
$ git remote -v
origin https://github.com/oliverzhouzhou/test.git (fetch)
origin https://github.com/oliverzhouzhou/test.git (push)
14500@oliverzhou MINGW64 ~/PycharmProjects/test (slave01)
$ git branch -a
master
* slave01
remotes/origin/master
remotes/origin/slave01
5 Change to another branch
git checkout xxx
14500@oliverzhou MINGW64 ~/PycharmProjects/test (slave01)
$ git checkout master
Switched to branch 'master'
A .idea/vcs.xml
Your branch is up to date with 'origin/master'.
14500@oliverzhou MINGW64 ~/PycharmProjects/test (master)
$
PROBLEMS
Git报错: Failed to connect to github.com port 443 已解决
自己有vpn,网页可以打开github。
说明命令行在拉取/推送代码时并没有使用vpn进行代理
所以给其添加代理,
socks5代理
git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890
http代理
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890
我使用的是clash,记忆中是打开的system proxy 所以使用http代理。
PS C:\Users\14500> git config --global http.proxy 127.0.0.1:7890
PS C:\Users\14500> git config --global https.proxy 127.0.0.1:7890
然后就可以成功提交
ADDITION:
查看代理
git config --global --get http.proxy
git config --global --get https.proxy
PS C:\Users\14500> git config --global --get http.proxy
127.0.0.1:7890
PS C:\Users\14500> git config --global --get https.proxy
127.0.0.1:7890
Delete Branch
git branch -d xxx
git branch -D xxx
Log
git log