Giter Club home page Giter Club logo

demos's Introduction

git 安装
~/.ssh                                              #检查计算机ssh密钥
mkdir key_backup                                    #创建密钥备份文件夹
cp id_rsa* key_backup                               #复制密钥到备份文件夹
rm id_rsa*                                          #删掉原来的密钥
ssh-keygen -t rsa -C "[email protected]"             #填写email地址,生成新密钥
vim id_rsa.pub                                      #查看id_rsa.pub文件的密钥,添加到github(add ssh),这里产生token
git config --global user.name "libill"              #给自己起个用户名
git config --global user.email "[email protected]"   #填写自己的邮箱
git config --global github.user libill              #github上的用户名
git config --global github.token yourtoken          #token为添加SSH key成功后可以看到,复制过来
git config --global credential.helper store         #git避免每次提交获取最新代码时,都需要输入账号密码

git 使用
ssh -T [email protected]                               #登录github
cd <fileName>                                       #进去该文件夹
cd ..                                               #返回到上一层文件夹
touch .gitignore                                    #创建gitignore隐藏文件,把服务器上的文件夹或文件删掉才起作用,why
git branch                                          #查看本地分支
git branch -a                                       #查看远程分支
git branch <branchName>                             #添加本地分支
git branch -d <branchName>                          #删除本地分支
git push origin <branchName>                        #把本地分支推送到远程服务器,等于在服务器创建了一条分支
git push origin tag <branchName>                    #把本地tag推送到远程服务器,等于在服务器创建了一条tag
git checkout <branchName>                           #切换分支
git push origin --delete <branchName>               #删除远程分支
git push origin --delete tag <tagname>              #删除远程tag
git pull                                            #把远程的更改全部拉到本地
git checkout -- + 需要恢复的文件名                   #把某个文件恢复到最后一次提交的改动
git cherry-pick <commitName>                        #把其他分支的某一次commit合并到当前分支
git revert <commit id>                              #用一次新的commit来回滚之前的commit
git revert <commit id> -m 1                         #用一次新的commit来回滚之前的merge commit

无法添加某个文件夹时
git rm --cached directory
git add directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.