git orphan submodule worktree example

Categories: Git
Example 1 directories $ ll -a total 22 drwxr-xr-x 1 alons 197609 0 2月 18 19:56 ./ drwxr-xr-x 1 alons 197609 0 2月 18 19:53 ../ drwxr-xr-x 1 alons 197609 0 2月 18 20:04 .git/ -rw-r--r-- 1 alons 197609 7 2月 18 19:53 .gitignore -rw-r--r-- 1 alons 197609 116 2月 18 19:53 .gitmodules drwxr-xr-x 1 alons 197609 0 2月 18 19:53 archetypes/ -rw-r--r-- 1 alons 197609 2381 2月 18 19:53 config.

Read More →

fork后同步原仓库

Categories: Git
configuring a remote for a fork 查看远程状态 git remote -v # origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch) # origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push) 添加一个将被同步给 fork 远程的上游仓库 git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git 再次查看远程状态 git remote -v # origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch) # origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push) # upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch) # upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push) syncing a fork 从原仓库fetch数据到本地,并会被存储在本地分支upstream/master git fetch upstream # remote: Counting objects: 75, done. # remote: Compressing objects: 100% (53/53), done.

Read More →

配置多个GIT

Categories: Git
.ssh文件夹下建立config文件: # 84 Host 172.28.10.84 HostName 172.28.10.84 PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_84 执行ssh-agent让ssh识别新的私钥 ssh-add ~/.ssh/id_rsa_84 该命令如果报错:Could not open a connection to your authentication agent.无法连接到ssh agent,可执行ssh-agent bash命令后再执行ssh-add命令

git常用命令

Categories: Git
git config --global user.name "Alonsovau" git config --global user.email "alonsovau@outlook.com" mkdir learngit pwd 查看完整路径 git init git add readme.txt git commit -m "wrote a readme file" git status git diff readme.txt git log git log --pretty=oneline git reset --hard HEAD^ 退回上一个版本 HEAD^^上上个版本 git reset --hard 4f1be52c 到指定的某个版本 git log得到的commit id的部分即可 git reflog 用来记录你的每一次命令 git checkout -- readme.txt 丢弃工作区修改 --后面要加空格 不然爆炸 场景1:当你改乱了工作区某个文件的内容,想直接丢弃工作区的修改时,用命令git checkout – file。 场景2:当你不但改乱了工作区某个文件的内容,还添加到了暂存区时,想丢弃修改,分两步,第一步用命令git reset HEAD file,就回到了场景1,第二步按场景1操作。 场景3:已经提交了不合适的修改到版本库时,想要撤销本次提交,参考版本回退一节,不过前提是没有推送到远程库 rm test.

Read More →