git 常见命令
打包命令, 和遠端進行對比
git diff origin/master --name-only | xargs tar cvzf ../../Users/zhengming809/Desktop/1111_aaaa.tar.gz
?
刪除遠端分支命令:
1: git push origin --delete 分支名字(比如: examination/152012_test, 注意這里不用加/,比如/examination/152012_test)
2: 推送一個空的分支到遠程分支 git push origin :分支名字
?
恢復被 rm 后的文件
git checkout -- .
?
分支 直接推送到遠端:
git push origin exmanation/150811_poker_guess
?
git 合并最新主干:
git fetch origin && git remote prune origin
git merge --no-ff origin/master
git push origin feature/150413_guessmax
?
git 回滾的命令
git reset --hard HEAD或版本號
?
git 刪除分支
git checkout master // 由于不能直接刪除分支
git branch -d feature/150413_guessmax
?
git 建立上新分支
cd /data/httpd/game5/
rm -rf wap 刪除目錄(這里一定要注意,不要刪除別人的)
mkdir wap 新建目錄
cd wap 去目錄里面
git init 初始化
添加遠程倉庫 wap 或者pc
git remote add origin http://www:12345678@21.56.65.1/wlt_game_php/gamehall.git
git remote add origin http://www:12345678@21.56.65.1/wlt_game_php/gamepc.git
?
獲取遠端分支
git fetch --depth=1
新建分支
git checkout -b feature/150428_zhongchouluodiye origin/feature/150428_zhongchouluodiye
拷貝 wap 或者 pc 的 config.php
cp /data/httpd/game_config/gameHall/app/config.php app/
cp /data/httpd/game_config/gamepc/app/config.php app/
?
SVN 建立新分支
1.
去 repo-browser, 路徑是
examination/youxi.wanlitong.com/trunk
右鍵 copy to http://10.35.52.246/svn/youxi/php/youxi.wanlitong.com/branches/2015-04-20_caidaxiao
2.
去測試環境
ssh www@25.17.1.37 / 123qwe
cd /data/httpd/game5/
cp -rf pc ./pc_bak //先備份
rm -rf pc
svn co http://192.168.42.103/svn/youxi/php/youxi.wanlitong.com/branches/2015-2-25_caipiaoTdianchonghuafei ./pc
cd pc
svn info
cd app
cp xxxx/config.php config.php
?
sourceTree 新建一個分支:
配置git:
新建一個目錄 -> 進入目錄 -> git init -> 添加工作副本 -> 選擇本地文件 -> 設置 -> URL/路徑
http://zhengming809:12345678@10.35.52.34/wlt_game_php/gamehall.git -> git fetch
新建一個分支:
先把 master 和 develop 同步到本地 -> git 工作流 填v -> 建立新功能 -> 自己命名一個名字
新建一個測試環境:
要先進入到 wap或者pc 里面才有 git命令
git branch -avv 查看當前的 brantch
git 工作流 建立新功能
自己命名一個名字
cd /data/httpd/game12/wap
git init
git remote add origin http://www:12345678@25.17.1.204/wlt_game_php/gamehall.git 在本地倉庫上添加一個遠程倉庫
git fetch
git status
git checkout -b feature/150413_guessmax origin/feature/150413_guessmax
(git checkout feature/150413_guessmax) // 已經有這個分支, 則直接切換到這個分支
rm app/config.php
cp /data/httpd/game_config/gameHall/app/config.php app/config.php
?
sz 下載命令
rz -y 強制上傳命令
?
測試環境沖突的解決方案: git reset --hard origin/examination/160324_pad_tuiguang
?
設置當前庫的硬盤的值:
git config http.postBuffer 524288000
?
git remote -v 查看當前的遠程庫
git remote rm origin 刪除遠程庫
?
// 設置和修改遠端對應的分支
git remote set-url origin http://www:12345678@21.56.65.1/wlt_game_php/gamehall.git
git remote set-url origin http://www:12345678@21.56.65.1/wlt_game_php/gamepc.git
轉載于:https://www.cnblogs.com/zhengming2016/p/6992123.html
總結
- 上一篇: ssh-keys git
- 下一篇: scala面向对象之trait