git相关操作

来源:互联网 发布:ubuntu启动gnome界面 编辑:程序博客网 时间:2024/06/05 07:37

1.git alter username

git config user.name

git config user.email

git config --global user.name "username"

git config --global user.email "email"

2.git del remote files

git status
git rm .idea --cached -r
git rm app.iml --cached -r
git add -A
git status
git commit -m "update gitignore"
git push

3.git fetch upstream

https://help.github.com/articles/fork-a-repo/

 git remote add upstream xxxx.git
 git fetch upstream

 git merge upstream/master
 git status

git commit -m "xx"
git push

3.2.https://gist.github.com/CristinaSolana/1885435
git pull upstream master

 git merge origin/master --allow-unrelated-histories

one command sync
 git fetch upstream
1. git merge upstream/master 

2.git merge upstream/develop master
 git push

4.transfer remote branch
git remote set-url origin ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/TestAndroid
git status
git push

4.1.right click mouse--> git Bash Here   input  git clone <remote url>
4.2.1  copy the file where need under vcs
4.2.2. git status
4.3.git add -A
4.4.git status 
4.5.git commit -m "info"
4.6.git push

5.0 git set proxy

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global http.proxy 'socks5://127.0.0.1:1080' 
git config --global https.proxy 'socks5://127.0.0.1:1080'

cancel proxy
git config --global --unset http.proxy
git config --global --unset https.proxy

切换分支

git checkout xxxx

6.create a new repository

…or create a new repository on the command lineecho "# TEstx" >> README.mdgit initgit add README.mdgit commit -m "first commit"git remote add origin git@github.com:montotone/TEstx.gitgit push -u origin master------>git pull origin branchname --allow-unrelated-histories…or push an existing repository from the command linegit remote add origin git@github.com:montotone/TEstx.gitgit push -u origin master

原创粉丝点击