赞
踩
工作中工程项目编码时会遇到了一些问题,以此分享。
问题:
工程目录下已创建.gitignore文件,代码编译后会生成各种后缀文件,git status时候会被追踪到这些中间文件,而这些文件又不需要提交,这个时候就需要用.gitignore忽略这些文件
dell@jingjin MINGW64 /e/cardtype/project (master) $ git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: Project/Listings/startup_gd32f30x_hd.lst modified: Project/Master.uvoptx modified: Project/Master.uvprojx modified: Project/Objects/Master.axf modified: Project/Objects/Master.build_log.htm modified: Project/Objects/Master.htm modified: Project/Objects/Master.lnp modified: Project/Objects/Master_Master.dep
.uvoptx
.axf
.htm
.lnp
.dep
git 安装:
Windows下配置Git
1、从git官网下载git:http://git-scm.com/downloads
2、使用默认设置,一直点next即可
3、环境配置:将git的bin路径添加到系统环境变量中。
目录中右键选择git bash Here出现git命令行窗口。
执行如下指令,采用的是默认的-c,即在输出中显示缓存的文件。可以查看输出的缓存文件中是否存在想要忽略的文件,确实发现存在我想忽略的文件
dell@jingjin MINGW64 /e/cardtype/project (master) $ git ls-files .gitignore CMSIS/core_cm4.h CMSIS/core_cm4_simd.h CMSIS/core_cmFunc.h CMSIS/core_cmInstr.h CMSIS/gd32f30x.h CMSIS/startup_gd32f30x_cl.s CMSIS/startup_gd32f30x_hd.s CMSIS/startup_gd32f30x_xd.s CMSIS/system_gd32f30x.c CMSIS/system_gd32f30x.h Project/Listings/startup_gd32f30x_hd.lst Project/Master.uvoptx Project/Master.uvprojx Project/Objects/Master.axf Project/Objects/Master.build_log.htm Project/Objects/Master.lnp Project/Objects/Master_Master.dep
git rm -r --cached xxx(文件名)
git ls-files
5.使用git命令行进行提交推送
git commit -m .//提交
it push origin master //推送
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。