git 常见命令
打包命令, 和遠(yuǎn)端進(jìn)行對(duì)比
git diff origin/master --name-only | xargs tar cvzf ../../Users/zhengming809/Desktop/1111_aaaa.tar.gz
?
刪除遠(yuǎn)端分支命令:
1: git push origin --delete 分支名字(比如: examination/152012_test, 注意這里不用加/,比如/examination/152012_test)
2: 推送一個(gè)空的分支到遠(yuǎn)程分支 git push origin :分支名字
?
恢復(fù)被 rm 后的文件
git checkout -- .
?
分支 直接推送到遠(yuǎn)端:
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或版本號(hào)
?
git 刪除分支
git checkout master // 由于不能直接刪除分支
git branch -d feature/150413_guessmax
?
git 建立上新分支
cd /data/httpd/game5/
rm -rf wap 刪除目錄(這里一定要注意,不要?jiǎng)h除別人的)
mkdir wap 新建目錄
cd wap 去目錄里面
git init 初始化
添加遠(yuǎn)程倉(cāng)庫(kù) 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
?
獲取遠(yuǎn)端分支
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.
去測(cè)試環(huán)境
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 新建一個(gè)分支:
配置git:
新建一個(gè)目錄 -> 進(jìn)入目錄 -> git init -> 添加工作副本 -> 選擇本地文件 -> 設(shè)置 -> URL/路徑
http://zhengming809:12345678@10.35.52.34/wlt_game_php/gamehall.git -> git fetch
新建一個(gè)分支:
先把 master 和 develop 同步到本地 -> git 工作流 填v -> 建立新功能 -> 自己命名一個(gè)名字
新建一個(gè)測(cè)試環(huán)境:
要先進(jìn)入到 wap或者pc 里面才有 git命令
git branch -avv 查看當(dāng)前的 brantch
git 工作流 建立新功能
自己命名一個(gè)名字
cd /data/httpd/game12/wap
git init
git remote add origin http://www:12345678@25.17.1.204/wlt_game_php/gamehall.git 在本地倉(cāng)庫(kù)上添加一個(gè)遠(yuǎn)程倉(cāng)庫(kù)
git fetch
git status
git checkout -b feature/150413_guessmax origin/feature/150413_guessmax
(git checkout feature/150413_guessmax) // 已經(jīng)有這個(gè)分支, 則直接切換到這個(gè)分支
rm app/config.php
cp /data/httpd/game_config/gameHall/app/config.php app/config.php
?
sz 下載命令
rz -y 強(qiáng)制上傳命令
?
測(cè)試環(huán)境沖突的解決方案: git reset --hard origin/examination/160324_pad_tuiguang
?
設(shè)置當(dāng)前庫(kù)的硬盤(pán)的值:
git config http.postBuffer 524288000
?
git remote -v 查看當(dāng)前的遠(yuǎn)程庫(kù)
git remote rm origin 刪除遠(yuǎn)程庫(kù)
?
// 設(shè)置和修改遠(yuǎn)端對(duì)應(yīng)的分支
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
轉(zhuǎn)載于:https://www.cnblogs.com/zhengming2016/p/6992123.html
總結(jié)
- 上一篇: ssh-keys git
- 下一篇: scala面向对象之trait