New answers tagged

1 vote
Accepted

Use Git Version of mv/rm etc When in Repository

I suggest you have some myrm / mymv script that git rev-parse in order to detect if you are inside the repo and act accordingly. Something like : ingitr="$(git rev-parse --is-inside-work-tree 2&...
user avatar
  • 3,416
3 votes

Use Git Version of mv/rm etc When in Repository

git mv does a different thing from normal mv and is very much not a drop-in replacement. For instance, it doesn't act on untracked files: touch foo git mv foo bar prints fatal: not under version ...
user avatar
  • 918
0 votes

GIT move files from folder to subfolder

From the parent of the Service directory, you can do: $ for file in Service/*/*; do if [[ -f "$file" ]]; then echo mv "$file" "$(dirname -- "$file")/...
user avatar
  • 219k
3 votes
Accepted

git diff: ignore comments

It’s possible to do this by filtering all files before diffing them. First, write a small helper, and call it stripcomments (executable, somewhere on your PATH): #!/bin/sh - exec grep -ve '^#' -- &...
user avatar
2 votes
Accepted

git show does not understand relative file names

In <rev>:<path> notation, the path is relative to the tree-ish object itself, not to the current directory, unless it starts with ./ or ../. In both cases absolute paths (…:/…) aren’t ...
user avatar
0 votes

git says "fatal: repository not found" when cloning from a lan apache server

I found the solution! You need to cd into/the/repository.git and run git update-server-info on the server.
user avatar
2 votes

How can I search only git tracked files with a specific file extension?

git grep can also do this for you: git grep import -- '*.hs' This will search for “import” in all git-tracked files matching *.hs, starting from the current directory.
user avatar
1 vote
Accepted

How can I search only git tracked files with a specific file extension?

I hope I'm not misreading the question. If you want " to search all git tracked files that contain the word import in any lines", that should be: git ls-files -z | xargs -0 grep -l import ...
user avatar
  • 26.1k
2 votes
Accepted

Have git diff color customization

The git-config(1) manual details the available slots; your added and changed might work instead as new and old. color.diff.<slot> Use customized color for diff colorization. <slot&...
user avatar
  • 31.7k

Top 50 recent answers are included