Git
Fetch a remote branch
- Create a local branch that tracks a remote branch
git checkout --track origin/develop
If you want to change the name of the local branch (NOT A GOOD IDEA)
git checkout --track -b gniagnia origin/develop
Amend without editing commit message
git commit --amend --no-edit
Copy current HEAD sha sum to clipboard
git rev-parse HEAD | xclip
Conditional Git configuration
Since git 2.13, there is an option to include configuration (or not) based on a condition
Here is an example use case
# Specific configurations for work and personnal repos
[includeIf "gitdir:~/code/work/"]
path = .gitconfig.work
[includeIf "gitdir:~/code/oss/"]
path = .gitconfig.oss
If include, settings in any configuration found file provided by the path parameter will by append to or will overide current configuration.
Switch to previous branch
git checkout -