git client command

本文详细介绍了一系列Git常用命令,包括清除本地仓库的远程分支、创建本地特性分支、对比修改记录、添加代码到暂存区、提交代码等操作步骤,并提供了解决远程分支缓存问题的方法。


git   client  command

git fetch -p  //

1,
用这句命令 git fetch --all --prune 可以清除本地仓库的远程分支,有强迫症的可以用一下,效果就是git branch -r看到的分支变少了
2,

//创建本地特性分支
1, git checkout -b developnew

//2 对比修改记录
git difftool

//3 添加所有代码到暂存区,还原某个文件git checkout "文件url"
git add .

// 4 提交本地仓库
git commit -m '注释'

// 5 切换到dev
git checkout develop

// 6 那最新
git pull

// 7 合并特性分支
git merge --no-ff -m '注释' 

// 8有冲突,分支变为develop|MERGING
git mergetool

// 9 提交冲突
git commit -m 'merge'

//10  提交代码 
git push origin develop

//11 merge 代码 
git merge --no-ff

///////////////////////////////
 // 12 查看当前代码 源  服务器地址
git remote -v  //版本文件


13,
/////////////
使用git 部署代码,git branch -a 里面列出的很多远程的分支,其实都是已经被删除了的。
可在git pull,他们仍旧是存在,如何删除这样的缓存?
git remote prune origin
or
git fetch -p

Started by user codemylife Running as SYSTEM Building in workspace /var/jenkins_home/workspace/weblog-springboot The recommended git tool is: NONE using credential 87b14820-3dea-45ea-bc41-8d8a63927482 > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/weblog-springboot/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://gitee.com/code-my-life/weblog.git # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://gitee.com/code-my-life/weblog.git at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999) at PluginClassLoader for git//hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1240) at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1311) at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1278) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1250) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:522) at hudson.model.Run.execute(Run.java:1860) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:454) Caused by: hudson.plugins.git.GitException: Command "git config remote.origin.url https://gitee.com/code-my-life/weblog.git" returned status code 128: stdout: stderr: fatal: not in a git directory at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2847) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2772) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2767) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2060) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2072) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1671) at PluginClassLoader for git-client//hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:182) at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:987) ... 12 more ERROR: Error fetching remote repo 'origin' Finished: FAILURE
08-25
Started by user admin Running as SYSTEM Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\ocr The recommended git tool is: NONE using credential 1 > git.exe rev-parse --resolve-git-dir C:\ProgramData\Jenkins\.jenkins\workspace\ocr\.git # timeout=10 Fetching changes from the remote Git repository > git.exe config remote.origin.url http://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git # timeout=10 Fetching upstream changes from http://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git > git.exe --version # timeout=10 > git --version # 'git version 2.39.2.windows.1' using GIT_ASKPASS to set credentials 1 > git.exe fetch --tags --force --progress -- http://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from http://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999) at PluginClassLoader for git//hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1240) at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1311) at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1278) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1250) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:522) at hudson.model.Run.execute(Run.java:1860) at PluginClassLoader for maven-plugin//hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:454) Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --force --progress -- http://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: fatal: Cannot prompt because user interactivity has been disabled. remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://lzgit.luxsan-ict.com/75600259/ai-llm-ocr.git/' at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2847) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2192) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:641) at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997) ... 12 more ERROR: Error fetching remote repo 'origin' Finished: FAILURE
最新发布
09-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值