[Git] Change case of a folder name
Make sure you have the ignorecase
set to false:
git config core.ignorecase false
Then, do two git mv
:
git mv foldername tempname
git mv tempname folderName
Make sure you have the ignorecase
set to false:
git config core.ignorecase false
Then, do two git mv
:
git mv foldername tempname
git mv tempname folderName
Use git rebase
to select commits you want to modify
git rebase -i --root
And then for each rebase step, execute the following:
git commit --amend --reset-author --no-edit
git rebase --continue
git clone --recurse-submodules remote_url
git submodule add submodule_remote_url local_linking_path
# Then commit & push to the main repo
# Pull from specific branch
git pull --recurse-submodules my-branch
# Then commit & push to the main repo
cd submodule_path
# Do the commits and push normally, the changes will be pushed to submodule repo
cd main
# Then do a commit and push to the main module
git submodule update --init
If you have master merged into your current branch, your git log
will be messy because it also shows the commits from the master.
If you want to show your branch logs, use the following command:
git log master..
or
git log master..mybranch
* git log a..b
actually means “includes commits that are (backward) reachable from b but exclude those that are reachable from a”
Assume you have conflicts after executing git stash pop
:
git reset
to mark conflicts as resolvedgit stash drop
because git doesn’t do it if conflicts occurAssume we have following branches:
We want to cut commit_3 and commit_4 on branch_2, onto master (commit_2). We can use the commands:
git checkout branch_2
git rebase --onto b111dc9 34e3359
(git rebase --onto new_base old_base)
The result looks like this:
If we want the commits but not to modify the incoming branch (branch_2 in the above example), we can use cherry-pick
:
git checkout master
git cherry-pick 34e3359..321b7c0
(git cherry-pick start_commit_not_included..end_commit_included)
This is an easy way to show a pretty git log using alias.
git log --oneline --decorate --all --graph
git config --global alias.tree "log --oneline --decorate --all --graph"
Then, use git tree
to show the tree view:
使用指令:
git rebase -i 61d3628 -r
onto為rebase指定的commit,此例為61d3628 。
直接編輯各commit的順序及是否生成merge commit,即可隨心所欲整理merge commits.
下圖為將b2的merge拉直的結果
git tag -l
git tag -a v1.0 -m "my version message"
git push origin --tags
git push origin :refs/tags/v1.0
將欲取消追蹤的檔案加入.gitignore
在repo中刪除該檔案:
git rm -r --cached .
git commit -m "Untrack and delete filename in repo."
push到遠端