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