Moving commits between branches
Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.
cherry-pick
does support a range of commits, but if you have merge commits in that range, it gets really complicated
git checkout branch-B
git cherry-pick X
git cherry-pick Y
Reference https://gist.github.com/unbracketed/889c844473bcca1917e2
Different Git Config at a Folder Level
(for Work and Personal)
-
create a separate folders where clone work vs. personal repos to. eg:
~/work/mp/repository
for personal repositories~/work/company-name/repository
for work related repositories
-
split your git config into three parts - a shared config in home, and per-directory configs
-
in the shared config (i.e.:
.gitconfig
) add any settings you want to share between git hosts.-
[user] name = Melissa Palmer [includeIf "gitdir:~/work/company-name/"] path = ~/work/company-name/.gitconfig [includeIf "gitdir:~/work/mp/"] path = ~/work/mp/.gitconfig
-
-
then configure your email address per folder (git hosts)
-
in the file
~/work/mp/.gitconfig
-
[user] email = melissa.palmer@personalemail.com
-
-
in the file
~/work/company-name/.gitconfig
-
[user] email = melissa.palmer@company-name.com
-
-
-
test that your setup is working
- PERSONAL folder
cd ~/work/mp/a-work-repository
- Run
git config user.email
- you should see the setting for
melissa.palmer@personalemail.com
- WORK
cd ~/work/company-name/a-work-repository
- Run
git config user.email
- you should see the setting for
melissa.palmer@company-name.com
- PERSONAL folder
References
- https://dev.to/davidjones418/per-directory-git-config-3ec9
- https://www.codeproject.com/Articles/5297072/How-to-Set-Different-Git-Config-user-email-and-use (Windows related)