现在希望用git将本地文件test目录下的文件更新到远程仓库指定crawler目录下,命名相同的文件本地文件将其覆盖

'''

回到仓库根目录

cd D:\Work1\VectorETL

拉取远程最新内容

git checkout main

git pull origin main

删除 Git 跟踪的 crawler 文件内容(不会影响远程中你本地没有的文件)

git ls-files crawler/ | foreach { Remove-Item $_ -Force }

复制本地 crawler 文件内容到 Git 仓库 crawler 目录

Get-ChildItem -Path "D:\黑马大数据学习\test*" -Recurse | ForEach-Object {

dest = Join-Path "crawler" *.Name
Copy-Item * .FullName dest -Recurse -Force

}

添加更改(只会添加你本地有的文件)

git add crawler/

提交更改

git commit -m "更新 crawler 目录内容,覆盖远程中同名文件"

推送到远程 main 分支

git push origin main

不改变其内容

'''

'''

回到仓库根目录

cd D:\Work1\VectorETL

拉取远程最新内容

git checkout main

git pull origin main

安全复制本地 crawler 文件内容到 Git 仓库 crawler 目录

Get-ChildItem -Path "D:\黑马大数据学习\test*" -Recurse | ForEach-Object {

复制代码
$dest = Join-Path "crawler" $_.FullName.Substring("D:\黑马大数据学习\test".Length)
if (Test-Path $dest) {
    Remove-Item $dest -Recurse -Force
}
Copy-Item $_.FullName $dest -Recurse -Force

}

添加更改

git add crawler/

提交更改

git commit -m "更新 crawler 目录内容,覆盖远程中同名文件"

推送远程

git push origin main

删除其内容

'''

相关推荐
深蓝电商API9 小时前
实战:爬取豆瓣电影Top250,并生成Excel榜单
爬虫·python·excel
爱学习的徐徐11 小时前
Python 豆瓣TOP250 爬虫类讲解
爬虫·python
小白学大数据11 小时前
Python爬虫技术:招标信息抓取与关键词过滤 (1)
开发语言·爬虫·python
电商API_1800790524712 小时前
获取淘宝商品视频API接口解析:通过商品链接url获取商品视频item_video
开发语言·爬虫·python·数据挖掘·数据分析
SStone_TJ18 小时前
【常用的git命令】
git
没有鸡汤吃不下饭19 小时前
Git将某个分支合并到开发(dev)、测试(test)后突然想撤销该分支的功能,怎么处理?
前端·git·github
深蓝电商API19 小时前
Requests 库详解:爬虫工程师的 “瑞士军刀”
爬虫·request
康一夏19 小时前
git fatal:Server aborted the SSL handshake
git·网络协议·ssl
深蓝电商API20 小时前
HTML 解析入门:用 BeautifulSoup 轻松提取网页数据
前端·爬虫·python·beautifulsoup
Vio7251 天前
在IntelliJ IDEA中使用Git
git