В нашем репо (потому что он большой) делать перебазирование является болезненным, мы все работаем над собственной веткой master, фиксируем локально, выбираем, перебазируем, затем проталкиваем, в основном мы в итоге делаем
git fetch
git stash
git rebase
git stash pop
git push
Этопроцесс может занять 30-60 секунд (в основном это псевдоним в 1 команде)
В течение этого времени он действительно убирает руку с клавиатуры, потому что если вы дотронетесь до каких-либо файлов, вы можете вызвать «неустановленные изменения» и сбой перебазировки
У людей очень часто есть рабочие копии неподготовленных файлов, которые еще не являются частью какого-либо коммита (отсюда необходимость в тайнике)
Если вы используете Visual Studio, вы видите, что Visual Studio спрашивает, хотите ли вы перезагрузитьфайлы (поскольку он перемещает ваши файлы в сторону и обратно)
Все это немного раздражает ... и немного подвержено ошибкам.Я подумал, есть ли лучший способ:
- Учитывая, что вы только что сделали git fetch, вы знаете исходный / основной коммит
- Вы знаете свой собственный коммит HEAD
- Вы могли бы подумать, что возможно сохранить ТОЛЬКО те файлы, которые являются частью коммитов между вашим текущим коммитом и коммитом origin / master
- Такое ощущение, что нет необходимости хранить какие-либо файлы, которые не являютсямне нужно будет объединить
Я также заметил, что, когда тайник перемещает файлы без меток с пути и обратно (что не изменяется при перебазировке), он изменяет время модификациифайл.Если у вас есть система сборки, которая работает с зависимостями, то это приведет к необходимости перекомпоновки этих затронутых файлов
Поэтому мой вопрос:
- возможно ли сделать ограниченное (только для затронутых файлов)) stash?
- Можно ли в stash pop сохранить время модификации с момента, когда они были спрятаны?
- Есть ли лучший способ работы?
Многиеспасибо заранее
Дополнительная информация ... большую часть времени занимает всплывающее окно с тайниками и тайниками
Общее время хранения = 17: 17: 52.883984 - 17: 16: 34.682266= 1 минута 18 секунд Общее время всплытия тайника = 17: 19: 25.326706 - 17: 18: 23.357639 = 1 минута 2 секунды
$ GIT_TRACE=true git stash
17:16:34.682266 git.c:576 trace: exec: git-stash
17:16:34.683120 run-command.c:640 trace: run_command: git-stash
17:16:35.392884 git.c:576 trace: exec: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
17:16:35.394043 run-command.c:640 trace: run_command: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
17:16:35.574243 git.c:576 trace: exec: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
17:16:35.575410 run-command.c:640 trace: run_command: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
17:16:35.902034 git.c:344 trace: built-in: git rev-parse --git-dir
17:16:36.104332 git.c:344 trace: built-in: git rev-parse --git-path objects
17:16:36.499926 git.c:344 trace: built-in: git rev-parse --show-prefix
17:16:36.679648 git.c:344 trace: built-in: git rev-parse --show-toplevel
17:16:36.890647 git.c:344 trace: built-in: git rev-parse --git-path index
17:16:37.083861 git.c:344 trace: built-in: git config --get-colorbool color.interactive
17:16:37.251940 git.c:344 trace: built-in: git config --get-color color.interactive.help 'red bold'
17:16:37.421967 git.c:344 trace: built-in: git config --get-color reset
17:16:37.594741 git.c:344 trace: built-in: git rev-parse --sq --prefix src/mydir --
17:16:37.779674 git.c:344 trace: built-in: git ls-files --error-unmatch --
17:16:38.055453 git.c:344 trace: built-in: git update-index -q --refresh
17:16:51.868211 git.c:344 trace: built-in: git diff-index --quiet --cached HEAD --ignore-submodules --
17:16:52.292151 git.c:344 trace: built-in: git diff-files --quiet --ignore-submodules --
17:17:05.488052 git.c:344 trace: built-in: git reflog exists refs/stash
17:17:05.679272 git.c:344 trace: built-in: git update-index -q --refresh
17:17:18.769370 git.c:344 trace: built-in: git diff-index --quiet --cached HEAD --ignore-submodules --
17:17:19.147722 git.c:344 trace: built-in: git diff-files --quiet --ignore-submodules --
17:17:32.039258 git.c:344 trace: built-in: git rev-parse --verify HEAD
17:17:32.322507 git.c:344 trace: built-in: git rev-list --oneline -n 1 HEAD --
17:17:32.721850 git.c:344 trace: built-in: git symbolic-ref -q HEAD
17:17:32.963491 git.c:344 trace: built-in: git write-tree
17:17:33.479251 git.c:344 trace: built-in: git commit-tree 2372528ce6a7cf773c3e7df932ea1762f69459e4 -p 270db9ff224e8b7baaa76f3f12dc55cf04dd7c5f
17:17:33.842338 git.c:344 trace: built-in: git read-tree --index-output=.git/index.stash.31348 -m 2372528ce6a7cf773c3e7df932ea1762f69459e4
17:17:35.405659 git.c:344 trace: built-in: git diff-index --name-only -z HEAD --
17:17:50.044073 git.c:344 trace: built-in: git update-index -z --add --remove --stdin
17:17:50.788781 git.c:344 trace: built-in: git write-tree
17:17:51.617735 git.c:344 trace: built-in: git commit-tree 4af893fdd10d58762651befa2bbb8eee71f291ac -p 270db9ff224e8b7baaa76f3f12dc55cf04dd7c5f -p 323f7da91a6ddfe52f0346d3e3fa6506cfde0fbb
17:17:51.938857 git.c:344 trace: built-in: git update-ref --create-reflog -m 'WIP on master: 270db9ff224 Mylastcommit' refs/stash da808c64188e12626e92107d95433f507415e053
17:17:52.380955 git.c:576 trace: exec: git-sh-i18n--envsubst --variables 'Saved working directory and index state $stash_msg'
17:17:52.382510 run-command.c:640 trace: run_command: git-sh-i18n--envsubst --variables 'Saved working directory and index state $stash_msg'
17:17:52.619887 git.c:576 trace: exec: git-sh-i18n--envsubst 'Saved working directory and index state $stash_msg'
17:17:52.621484 run-command.c:640 trace: run_command: git-sh-i18n--envsubst 'Saved working directory and index state $stash_msg'
Saved working directory and index state WIP on master: 270db9ff224 Mylastcommit
17:17:52.883984 git.c:344 trace: built-in: git reset --hard -q
Вспышка тайника
$ GIT_TRACE=true git stash pop
17:18:23.357639 git.c:576 trace: exec: git-stash pop
17:18:23.358544 run-command.c:640 trace: run_command: git-stash pop
17:18:25.532417 git.c:576 trace: exec: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
17:18:25.535394 run-command.c:640 trace: run_command: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
17:18:26.782965 git.c:576 trace: exec: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
17:18:26.786540 run-command.c:640 trace: run_command: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
17:18:30.387292 git.c:344 trace: built-in: git rev-parse --git-dir
17:18:30.846062 git.c:344 trace: built-in: git rev-parse --git-path objects
17:18:31.444631 git.c:344 trace: built-in: git rev-parse --show-prefix
17:18:31.688101 git.c:344 trace: built-in: git rev-parse --show-toplevel
17:18:31.958273 git.c:344 trace: built-in: git rev-parse --git-path index
17:18:32.214299 git.c:344 trace: built-in: git config --get-colorbool color.interactive
17:18:32.505740 git.c:344 trace: built-in: git config --get-color color.interactive.help 'red bold'
17:18:32.894387 git.c:344 trace: built-in: git config --get-color reset
17:18:33.251394 git.c:344 trace: built-in: git rev-parse --verify --quiet refs/stash
17:18:33.571029 git.c:344 trace: built-in: git rev-parse --symbolic --verify --quiet 'refs/stash@{0}'
17:18:33.883359 git.c:344 trace: built-in: git rev-parse --verify --quiet 'refs/stash@{0}^2'
17:18:34.655407 git.c:344 trace: built-in: git rev-parse --symbolic-full-name refs/stash
17:18:34.842979 git.c:344 trace: built-in: git rev-parse --verify --quiet 'refs/stash@{0}^3'
17:18:35.180608 git.c:344 trace: built-in: git update-index -q --refresh
17:18:50.084605 git.c:344 trace: built-in: git write-tree
17:18:50.728293 git.c:344 trace: built-in: git merge-recursive 2372528ce6a7cf773c3e7df932ea1762f69459e4 -- 2372528ce6a7cf773c3e7df932ea1762f69459e4 4af893fdd10d58762651befa2bbb8eee71f291ac
17:18:53.083985 git.c:344 trace: built-in: git diff-index --cached --name-only --diff-filter=A 2372528ce6a7cf773c3e7df932ea1762f69459e4
17:18:53.875222 git.c:344 trace: built-in: git read-tree --reset 2372528ce6a7cf773c3e7df932ea1762f69459e4
17:18:55.686552 git.c:344 trace: built-in: git update-index --add --stdin
17:18:56.025110 git.c:344 trace: built-in: git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ....
....
Untracked files:
(use "git add <file>..." to include in what will be committed)
....
It took 13.53 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
no changes added to commit (use "git add" and/or "git commit -a")
17:19:24.442842 git.c:344 trace: built-in: git reflog delete --updateref --rewrite 'refs/stash@{0}'
17:19:24.783530 git.c:576 trace: exec: git-sh-i18n--envsubst --variables 'Dropped ${REV} ($s)'
17:19:24.785203 run-command.c:640 trace: run_command: git-sh-i18n--envsubst --variables 'Dropped ${REV} ($s)'
17:19:25.045532 git.c:576 trace: exec: git-sh-i18n--envsubst 'Dropped ${REV} ($s)'
17:19:25.047257 run-command.c:640 trace: run_command: git-sh-i18n--envsubst 'Dropped ${REV} ($s)'
Dropped refs/stash@{0} (da808c64188e12626e92107d95433f507415e053)
17:19:25.326706 git.c:344 trace: built-in: git rev-parse --verify --quiet 'refs/stash@{0}'
Total Stash Pop Time = 17:19:25.326706 - 17:18:23.357639 = 1 minutes, 2 seconds
КогдаЯ сделал недавнее обновление, которое я понял, что это заняло 3-4 минуты, чтобы сделать полный stash / rebase / pop
Я даже использую новые встроенные rebase и stash, чтобы попытаться ускорить процесс
https://github.com/git-for-windows/git/pull/1800 и git v2.20
[rebase]
useBuiltin = true
[stash]
useBuiltin = true
и другие лучшиепрактики
(например, мой диск - SSD)
[core]
preloadindex = true
fscache = true