首页 > 其他分享 >Git:

Git:

时间:2023-04-24 20:15:38浏览次数:29  
标签:origin git -- Git branch main store

 

git config remote.origin.url https://github.com/namespace/repo.git
git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*

git fetch --tags --force --progress -- https://github.com/namespace/repo.git +refs/heads/*:refs/remotes/origin/*

Use '--' to separate paths from revisions. git <command> [<revision>...] -- [<file>...]

git rev-parse refs/remotes/origin/main^{commit}
git rev-parse remotes/origin/main^{commit}
git rev-parse origin/main^{commit}

git rev-parse --resolve-git-dir /opt/jenkins/workspace/folder-1/esoteric.git

git rev-list --no-walk fb0e19f

# The “cache” mode keeps credentials in memory for a certain period of time. None of the passwords are ever stored on disk, and they are purged from the cache after 15 minutes.
git config --global credential.helper cache
git credential-cache -h

# The “store” mode saves the credentials to a plain-text file on disk, and they never expire. This means that until you change your password for the Git host, you won’t ever have to type in your credentials again. The downside of this approach is that your passwords are stored in cleartext in a plain file in your home directory.
git config --global credential.helper 'store --file ~/.git-credentials'
git credential-store -h

git help credential

# Custom credenetial helper

$ git credential-store --file ~/git.store store (1)
protocol=https
host=mygithost
username=bob
password=s3cre7
$ git credential-store --file ~/git.store get (2)
protocol=https
host=mygithost

username=bob (3)
password=s3cre7

# System
[credential]
    helper = osxkeychain
    helper = store --file ~/.git-credentials
    helper = cache --timeout 36000
[init]
    defaultBranch = main


git config --local alias.pushd 'push -u origin HEAD'

git checkout --track  # --track隐含创建新分支
git checkout --track=direct origin/main  # 从origin切新出新的本地分支main, 设置track, 不能使用--track=inherit, origin/main has no remote
git checkout --track=inherit -b esoteric  # 从当前HEAD切一个本地esoteric分支, -b都是从当前HEAD切

HEAD is what Git calls a symbolic reference (a reference to another reference), in non-bare repository, HEAD normally indicates which branch is currently checked out. A new commit will cause the branch named by HEAD to be advanced to refer to the new commit.
In bare repositories, HEAD indicates the repository's default branch, so that in a clone of the repository git checkout origin is equivalent to git checkout origin/main if main is the default branch

git branch --set-upstream-to origin/my_remote_branch my_local_branch
git branch --track=inherit new_branch start_point

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

 

标签:origin,git,--,Git,branch,main,store
From: https://www.cnblogs.com/dissipate/p/17350700.html

相关文章

  • gitlab 开发人员更换手机后MFA认证无法登录
    目录gitlab开发人员更换手机后MFA认证无法登录解决方法gitlab开发人员更换手机后MFA认证无法登录开发人员用mfa二次认证登录gitlab,有开发更换手机后,发现登录gitlab时必须输入mfa二次认证解决方法需要找运维管理人员,登录mfa取消二次认证,登录后自己再开启二次认证运维人员以......
  • GitLab-DevOps思想
    1、什么是DevOps:  DevOps是Development(开发)和Operations(运维)的缩写,是一组过程、方法与系统的统称;强调“应用程序/软件工程”的开发、技术运营和质量保障(QA)人员之间沟通、协作一体化。实现持续集成、持续交付,包括持续部署。2、DevOps的意义:  ......
  • 【colab】怎么在colab打开github上的ipynb文件
    登录:https://colab.research.google.com/github/将github上的ipynb文件路径复制到框里面即可。......
  • GitLab-CI/CD使用
    一、 二、   GitLabCI/CD是GitLabContinuousIntegration(Gitlab持续集成)的简称。只要在项目仓库的根目录添加.gitlab-ci.yml文件,并且配置了gitlabRunner(运行器),那么每一次push或者合并请求(MergeRequest)都会触发CIPipeline。  1)GitLabRunner可以运行在GNU/Lin......
  • GitLab-理解里程碑(史诗)/议题,评论/主题,代码建议
    1、里程碑:  可以理解为对大的工作内容进行定义,比如构建一个版本、新增某个功能、变更某个需求。2、议题:  为对“里程碑”进行进行模块拆分,比如变更某个需求时设计到多个端进行修改、多个接口修改、多个接口修改时又涉及到其他系统业务场景进行测试。可对这些内容进行拆分,并......
  • git:回滚commit但未push代码
    这个场景经常出现,发现合并分支(从A分支合并到B分支)后,该分支(B分支)没有push提交权限,所以只能回滚(回滚B分支)合并merge后的记录,保持B分支干净,回到从前。gitlog查看提交日志命令:gitlog输入q则退出输出结果如下所示:解析:commit后是每次提交的唯一标志,从上往下时间是从近到远......
  • git 不提交target及imp等文件
    在sourcetree中设置忽略提交文件,如下图所示添加忽略内容为:HELP.md/target/!.mvn/wrapper/maven-wrapper.jar!**/src/main/**/target/!**/src/test/**/target/###STS###.apt_generated.classpath.factorypath.project.settings.springBeans.sts4-cache###Intel......
  • Git设置和码市操作
     gitremoteaddorigin+码云复制的路径 gitpulloriginmaster命令,将码云上的仓库pull到本地文件夹使用gitadd. (.表示所有的)或者gitadd+文件名  使用gitcommit-m'新添加的文件内容描述'  使用gitpushoriginmaster,将本地仓库推送到远程仓库touchr......
  • git 补丁
    生成补丁:git format-patch-N N 代表最近几次的提交应用补丁 git am 会将所有信息合入 包括提交人 和 提交日志 修改的文件加入存储队列 git log 可以看到提交的修改git apply  只包括文件本身的修改 修改的文件 在暂存区 可用 git status 查看 在......
  • Git最全内容整理,这一篇就够了
    关注我了解更多Python技术知识,带你一路“狂飙”到底!上岸大厂不是梦!你使用过Git吗?也许你已经使用了一段时间,但它的许多奥秘仍然令人困惑。Git是一个版本控制系统,是任何软件开发项目中的主要内容。通常有两个主要用途:代码备份和代码版本控制。你可以逐步处理代码,在需要回滚到......