git常用操作

2904 ワード

git常用操作
共通コマンド
1.git初期化:
//      
git config --global user.name "xxx"
//     
git config --global user.email "[email protected]"
//      
git config --lis

2.gitはSSH鍵を生成する
//        ssh  
cd ~/.ssh
//      3   ,                       :id_rsa id_rsa.pub
//     github    
ssh-keygen -t rsa -C "[email protected]"

3.コード提出
//        
git status
//                           
git add  
//     (new)    (modified)  ,      (deleted)  
git add .  
//     (modified)    (deleted)  ,      (new)
git add -u  
//      
git add -A  
//           
git commit -m "  "
//      —rebase        commit  
git pull --rebase
//        
git push
q         ,               
 --》 add -->commit -->pull -->push

4.ブランチ管理
//      
git branch
//    
git branch <name>
//     name
git checkout<name>
//  +    
git checkout -b <name>
//          
git merge <name>

5.ロールバック管理
//       
git reset --hard 2fb716d48b5366bd56474b5fca01743b7b4d3b38
//        
git reset --hard HEAD
//        
git reset HEAD 
//        
git checkout --