Git: Ignore whitespace when merging or cherry-picking
You can tell git to ignore different kinds and amounts of whitespace when merging or cherry-picking. This often occurs when you changed indentation, or converted tabs to spaces.
Simply use
git merge <REV> -Xignore-space-change
or
git cherry-pick <REV> -Xignore-space-change
Related cards:
How to not leave trailing whitespace (using your editor or Git)
There is no reason to leave trailing whitespace characters in your project's files, so don't add any.
A git diff --check
will tell you if there are any and you should not commit when you see them. So go ahead and switch your editor/IDE to autom...
Ignore commits when git blaming
You can ignore certain commits when using git blame with the --ignore-revs-file
option. This is handy to ignore large rubocop commits or big renamings in your project. You can add and commit a .git-blame-ignore-revs
file in your project to tra...
How to ignore new files or changed files in git
How to ignore new files
Globally
Add the path(s) to your file(s) which you would like to ignore to your .gitignore
file (and commit them). These file entries will also apply to others checking out the repo.
Loc...
Deployment: Merge consecutive commits without cherry-picking
You want to deploy new features but the latest commits are not ready for production? Then use git merge master~n
to skip the n-last commits.
Tip
A big advantage of merging vs. cherry-picking is that cherry-picking will create copies o...
Git blame: How to ignore white-space modifications
When doing a git blame
, git will blame the person who added or removed white space in a line (e.g. by indenting), not the person who originally wrote the code.
Say git blame -w
to ignore such white-space changes. You want this. \
Note that y...
Git: What to do when "git log" does not show commits that touch a file
Let's say you have commits that change a file (and looking at the commit details show you the changes, etc). Now, when you do a git log
you see them, but when you say git log that.file
these commits don't show up? This is for you.
The reason ...
Capistrano 3: How to deploy when a firewall blocks your git repo
Sometimes, through some firewall or proxy misconfiguration, you might have to deploy to a server that cannot access the git repository.
Solution 1: HTTP Proxy (this is the preferred fix)
SSH can be tunneled over an HTTP Proxy. For example, wh...
Git: See all unpushed commits or commits that are not in another branch
If you need to find out which of your local commits are not on the remote server do this:
git cherry -v
The -v
option prints out the commit messages. Without it you will see only the SHA1 codes.
You may also compare against another (upstr...
Git: When committing, check the diff
When committing, you should always check the diff of your changes so you don't include any leftovers or irrelevant/bad changes. Any time spent on that is well invested as it saves you rejected merge requests or any mess you need to clean up later....
How to push to Git without running CI on GitLab CI, GitHub Actions, or Travis CI
If a project ist configured to spawn CI runners for tests or deployment when pushing to the Repo, a habit of pushing WIP commits regularly may conflict with that.
Here are two solutions that allow you to keep pushing whenever you feel like it.
#...