git remind
Just a reminder for git usage.
跟上當初 fork 專案的進度
Step 1:
$ git remote -v
origin https://github.com/eddiekao/dummy-git.git (fetch)
origin https://github.com/eddiekao/dummy-git.git (push)
Step 2:
$ git remote add origin-upstream https://xxxxxxxx.git
Step 3:
git remote -v
origin-upstream https://github.com/kaochenlong/dummy-git.git (fetch)
origin-upstream https://github.com/kaochenlong/dummy-git.git (push)
origin https://github.com/eddiekao/dummy-git.git (fetch)
origin https://github.com/eddiekao/dummy-git.git (push)
Step 4:
git fetch origin-upstream
git merge origin-upstream/master
git push origin master
Submodule
移除 Submodule
//將 submodule 紀錄刪除
git submodule deinit -f <submodule folder>
//刪除 submodule 的 .git
rm -rf .git/modules/path/to/submodule
//刪除實體的目錄
git rm -f path/to/submodule
新增 Submodule
git submodule add https://github.com/xxxxxxxxx [<my path...>]
git submodule init
Cherry-pick
Stop tracking a file
.gitignore
will prevent untracked files from being added (without an add -f
) to the set of files tracked by Git, however Git will continue to track any files that are already being tracked.
To stop tracking a file you need to remove it from the index. This can be achieved with this command.
//single file
git rm --cached <file>
//folder
git rm -r --cached <folder>
⚠️WARNING: While this will not remove the physical file from your local, it will remove the files from other developers machines on next git pull.