**Git **
之前用git的時候唐瀑,從網(wǎng)上學(xué)習(xí)到的相關(guān)知識夕凝,格式比較亂。留作紀(jì)念次哈,畢竟不再寫代碼了。
http://192.168.0.55:3000/gogs/
source 'https://github.com/CocoaPods/Specs.git'
或者是source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
git命令
git branch 查看本地所有分支
git fetch 拉取所有遠(yuǎn)程分支
更新提交代碼
git add ./
git commit -m xx信息
git pull origin 分支名 (更新分支)
git push origin 分支名(提交本地代碼到分支XX)
cd ~/.cocoapods/repos
pod repo remove master
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后進(jìn)入自己的工程吆录,在自己工程的podFile第一行加上:
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
pod repo remove trunk
創(chuàng)建新分支
1窑滞、現(xiàn)切換到demo的分支
2、
git add ./
git commit -m xx
git checkout -b 新的分支名径筏。 Jia70739707,pd@pudu.live
克隆項目到本地
git clone http://192.168.1.55:3000/advance/yunbao-meiyan-ios.git
git checkout -b 本地分支名
//放棄本地拉取最新遠(yuǎn)程
git reset --hard origin/master origin/master替換為要拉取的遠(yuǎn)程分支名稱
git add ./
git commit -m XXX
git pull
//git fetch origin 遠(yuǎn)程分支名x
git pull origin 分支名稱
我現(xiàn)在在dev20181018分支上葛假,想刪除dev20181018分支
1 先切換到別的分支: git checkout dev20180927
2 刪除本地分支: git branch -d dev20181018
3 如果刪除不了可以強制刪除,git branch -D dev20181018
4 有必要的情況下滋恬,刪除遠(yuǎn)程分支:git push origin --delete dev20181018
5 在從公用的倉庫fetch代碼:git fetch origin dev20181018:dev20181018
6 然后切換分支即可:git checkout dev20181018
注:上述操作是刪除個人本地和個人遠(yuǎn)程分支聊训,如果只刪除個人本地,請忽略第4步
推送的本地分支和遠(yuǎn)程分支名字不一樣的時候:
git push origin master:MHSDKDemo_TX_iOS_Beta1.0.3
切換到一個新的分支:
git fetch origin 遠(yuǎn)程分支名x
git checkout -b 本地分支名x origin/遠(yuǎn)程分支名x
git rm -r --cached .DS_Store
git commit -m 'delete .DS_Store'
發(fā)現(xiàn)遠(yuǎn)程庫的 .DS_Store 已經(jīng)沒了恢氯。
然后在 gitignore 中忽略即可:
echo "[ -r ~/.bashrc ] && source ~/.bashrc" >> .bash_profile
設(shè)置跟蹤遠(yuǎn)程分支
git branch --set-upstream-to=origin/MHSDKDemo_3T_iOS_Beta1.0.3
//解決復(fù)用問題
// for(UICollectionViewCell *subcell in self.photosView.collectionView.subviews) {
// [subcell removeFromSuperview];
// }
沒有pod的第一次push代碼
cd 項目
git init
git add ./
git commit -m all
git remote add origin 你的遠(yuǎn)程庫地址
git push origin 本地:遠(yuǎn)程
或者是
git checkout -b本地分支
git push --set-upstream origin 遠(yuǎn)程分支
金山直播
pod 'libksygpulive', :git => 'https://github.com/ksvc/KSYLive_iOS.git', :tag => 'v3.0.5'
或者
source 'https://github.com/ElfSundae/CocoaPods-Specs.git'
source 'https://cdn.cocoapods.org/'
target 'Demo' do
pod 'libksygpulive' # 如果 libksygpulive 已經(jīng)在其他庫中指定為依賴带斑,這里可以不加這行
end
rm ~/Library/Caches/CocoaPods/search_index.json
這個是移除 再次執(zhí)行search會重新創(chuàng)建索引
git remote add origin**************
fatal: remote origin already exists.(報錯遠(yuǎn)程起源已經(jīng)存在。)
1勋拟、先輸入 git remote rm origin
2勋磕、再輸入 git remote add origin**************
禁止.DS_store生成:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
echo .DS_Store >> ~/.gitignore 在用戶目錄下生成
需要加全局設(shè)置
git config --global core.excludesfile ~/.gitignore
恢復(fù).DS_store生成:恢復(fù).DS_store生成
defaults delete com.apple.desktopservices DSDontWriteNetworkStores