svn: E175002: Error setting property 'ignore': Could not execute PROPPATCH.
error? svn: E175008: Commit failed (details follow): svn: E175008: At least one property change failed; repository is unchanged svn: E175002: Error setting property 'ignore': Could not execute PROPPATCH.
svn:ignore
property value (see Failed to execute WebDAV PROPPATCH when trying to commit a "ignore" file and JavaHL connector fails to commit svn:ignore property). To fix this re-save this property in Unix format. For that:svn propedit svn:ignore trunk
. This will start external EDITOR
(vi
in my case).Repeat this for all “damaged” properties. After that commit succeeds.
svn propset svn:global-ignores "*.o"
$ hg status $ abort: working directory has unknown parent 'd44a65b441c2'!
In this case do:
$ hg debugsetparents default $ hg revert --no-backup --all -r tip
git config --global branch.autosetuprebase always
From autosetuprebase vs autosetupmerge:
Controls whether new branches should be set up to be rebased upon
git pull
, i.e. your setting ofalways
will result in branches being set up such that git pull always performs a rebase, not a merge. Be aware that existing branches retain their configuration when you change this option.
git config --global pull.rebase preserve
From Make git pull --rebase preserve merge commits:
If a user is working on master, and has merged in their feature branch, but now has to
git pull
because master moved, withpull.rebase
their feature branch will be flattened into master. This is becausegit pull
currently does not know about rebase's preserve merges flag, which would avoid this behaviour, as it would instead replay just the merge commit of the feature branch onto the new master, and not replay each individual commit in the feature branch. Add a--rebase=preserve
option, which will pass along--preserve-merges
togit rebase
.
HEAD~2
– 2 commits older than HEAD
HEAD^2
– the second parent of HEAD
if HEAD
was a merge, otherwise illegalHEAD@{2}
– refers to the 3rd listing in the overview of git reflog
See also What's the difference between HEAD^ and HEAD~ in Git.
git reset --hard HEAD^
git reset HEAD^
git reset --hard
git rm
, git add
, …) and add them to previous commit with: git commit --amend
git checkout <file>
f25fcf53
by follow-up rollback commit: git revert f25fcf53
Suppose you're on master and you want to squash the last 12 commits into one:
git reset --hard HEAD~12
git merge --squash HEAD@{1}
(needs additional quoting on Windows e.g. git merge --squash "HEAD@{1}"
)git commit
The same:
git reset --soft HEAD~12
git commit
To apply changes to remote repository, do:
git push --force origin master
(replace master
with the name of your current branch).
ec5ef1e9
is commit hash you want to remove, then below will do the job:
git rebase -p --onto ec5ef1e9^ ec5ef1e9
For example, if your commit history is A-B-C-D-E-F
with F
as HEAD
, and you want to change the author of C
and D
then you would:
git rebase -i B
C
and D
to edit
. C
.git commit --amend --author="Author Name <email@address.com>"
git rebase --continue
D
.git commit --amend --author="Author Name <email@address.com>"
againgit rebase --continue
git commit --amend
(will launch vim
to enter new message) or git commit --amend -m "New commit message"
The same technique can be used to insert commit into the history as alternative to this one:
git rebase -i B
where B
is some commit in the past after which you want to insert the given one.
HEAD
minus one commit thus effectively undoing the change: git reset HEAD~ <file>
git add -u <file>
git commit --amend
or git rebase --continue
.
Alternative solution is to rewrite the whole history with the given file removed:
git filter-branch --prune-empty --tree-filter 'rm -f file_to_remove' --tag-name-filter cat -- --all
git filter-branch --force --prune-empty --tree-filter 'git ls-files | xargs file | sed -n -e "s/\(.*\): .*text.*/\1/p" | xargs dos2unix' --tag-name-filter cat -- --all
git push --force --all
git push --force --tags
core.autocrlf = input
, see How line ending conversions work with git core.autocrlf between different operating systems.
mydir
in repository myrepo
one can do the following:
git clone myrepo mynewrepo
cd mynewrepo
mydir
: git filter-branch --prune-empty --subdirectory-filter mydir --tag-name-filter cat -- --all
git filter-branch --prune-empty --subdirectory-filter mydir HEAD
Above method has one disadvantage which is written in documentation:
The result will contain that directory (and only that) as its project root.
To move the directory one level deeper requires another history rewrite… hence it's better to take another approach:
git clone my-repo my-repo-copy
cd my-repo-copy
mydir1
, mydir2
, …: git filter-branch --tree-filter 'ls -1 | egrep -v "^(mydir1|mydir2)" | xargs rm -rf .gitattributes .gitignore' 2> /dev/null" HEAD
cd ..
mydir1
, mydir2
, … to a temporary directory and split : git filter-branch --tree-filter "mkdir tmpdir; mv mydir1 mydir2 tmpdir 2> /dev/null" HEAD
git subtree split -P tmpdir -b tmpbranch
cd ..
mkdir new-repo && cd new-repo && git init
git pull ../my-repo-copy tmpbranch
git fetch ../another-repo --no-tags +tmpbranch:tmpbranch
git rebase tmpbranch
git remote add origin git@github.com:my-user/new-repo.git && git push origin -u master
git checkout HEAD~
git push origin HEAD:master
git checkout master
git cherry -v
to list all outgoing commits (to be pushed) for current branch.
git remote add upstream https://github.com/project/project.git
to add new upstream URLgit pull upstream [branch to merge]
which is the same as git fetch upstream
+ git merge
(for example: git pull upstream master
, git pull upstream release_2016-01-20
)git fetch upstream
+ git rebase
to rebase your work without needing a mergeSee here about how merge differs from rebase.
git branch
show all local branches (current branch is marked)git branch <branch>
to create new branch and start working in itgit checkout <branch>
to change the branch, e.g. git checkout master
will switch the repository to main branchgit branch -m <branch> <new name>
to rename local branchgit branch -D <branch>
to delete the branchgit branch -f master HEAD
to switch master branch, e.g. git branch -f master 010203A
to switch to particular commit (see How to move master to HEAD)
origin/master
branch already contains some features different from upstream/master
? git checkout -b myfix
git fetch upstream
upstream/master
with differences from master..myfix
incorporated: git rebase --onto upstream/master master
git push origin myfix
If you need to refine after submitting a pull request:
git checkout myfix
git rebase master
git commit --amend
upstream/master
: git rebase --onto upstream/master master
git push origin myfix -f
If any conflicts during the rebase, use git checkout --theirs <file>
to replace the file with your version (during rebase --ours
is referring upstream/master
).
Use git push origin --delete branch
which is the same as git push origin :branch
.
git branch new-branch-name origin/old-branch-name
git push origin new-branch-name
will add new branchgit push origin :old-branch-name
will remove old branchor
git push origin :old-branch-name
will remove remote old branchgit push origin local-branch-name:new-branch-name
will push local branch to remote but with new name
git tag new_tag old_tag
will create a new tag pointing to same commit as old taggit push --tags
will push new tag to remotegit push origin :refs/tags/old_tag
will delete the old tag from remote
git diff <branch> <file>
, e.g. git diff upstream/master pom.xml
Two tags:
git diff --color -M tags/one tags/two
git log --color --full-diff -p -M tags/one..tags/two
git log --full-history -- /path/to/removed/file
git log --author="Jon Smith"
git bisect
– это средство для двоичного поиска коммита, который все сломал. Допустим вы знаете коммиты где бага не было, и где баг уже есть. Цель – найти коммит, который посадил этот баг, за минимальное количество шагов. Откатываемся к коммиту, который точно посередине. Если бага в этой точки нет, то проблемный коммит справа, иначе он слева. Повторяем пока не найдём. Особенность git bisect
-а, что он умеет правильно обрабатывать нелинейные куски истории.
git blame
(assuming that is f25fcf53
), do the following iteratively until you find the needed commit (perhaps you need to make line number adjustment on each iteration):
git blame -n -L 810,+40 f25fcf53^ file.php
git show f25fcf53
git diff f25fcf53^!
git format-patch --stdout -<commits count> <commit hash>
For example
git format-patch -1 f25fcf53
will create a patch for one particular commit giving it a name derived from comment message. This patch can later be applied via
git am <file>
.git/config
change URL to https://user:password@github.com/...git
.git config credential.helper store
git gc --auto
to optimize the storage, which in turn runs git repack
when necessary.git fetch
. In this case a thin pack is created.
git reflog expire --all --expire=all
git repack -a -d -f --depth=500 --window=500 --threads=2
git gc --prune=now --aggressive
git.c
:
gcc git-wrapper -o git-wrapper.exe
: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { char buf[4000] = "/bin/bash -c 'C:/Applications/CygWin/git-wrapper.sh"; int rest = sizeof(buf) - strlen(buf) - 2; /* 2 for "'\0" */ for (int i = 1; i < argc; i++) { rest -= strlen(argv[i]) + 3; /* 3 for " \"\"" */ if (rest < 0) { fprintf(stderr, "arguments too long\n"); return 1; } strcat(buf, " \""); strcat(buf, argv[i]); strcat(buf, "\""); } strcat(buf, "'"); return system(buf); }
#!/bin/bash wrap_output="" argv=("$@") for ((i = 0; i < $#; i++)) do arg="${argv[$i]}" if [ $i = 0 -a "$arg" = 'rev-parse' ] then wrap_output=yes elif [[ -n "$arg" && "$arg" != -* ]] then argv[i]=`cygpath -u "$arg"` fi done if [ $wrap_output ] then if out=`git "${argv[@]}"` then if [ -n "$out" ] then if [[ $out = -* ]] then echo "$out" else cygpath -w "$out" fi fi else x=$? echo "$out" exit $x fi else exec git "${argv[@]}" fi
"git.path": "C:\\Applications\\CygWin\\git-wrapper.exe"
to %APPDATA%\Code\User\settings.json
.See also:
The requested URL returned error: 403 while accessing…
Update git to v1.7.x.
"Девица не хочет лезть в Окно" – device not compatible with Windows.