npp-usermanual

These will help me with npp-usermanual and team:npp-user-manual-admin

misc

git vs svn

Derived from Git for SVN users and other similar resources in the references section. Collating here (mainly because the original doc is now only available through the wayback machine).

; the branch -D may be needed to actually delete after being pruned
svngitnotes
main
svn checkout URLgit clone URL [DIR]checkout to specified directory (defaults to same as repo name)
svn checkout URL/subfolder git clone -n --depth=1 --filter=tree:0 URL cd newDirectory git sparse-checkout set --no-cone subfolder git checkout partial checkout => sparse checkout ...
SO Answer => keeps the full hierarchy even with subfolder/deepfolder
svn updategit pullGrab the most recent remote copy to working copy
svn infogit remote -v
or
git remote show origin
info about the repo/checkout
svn log | less
svn log -l 5
git log
git log -5
Show the log
Show the last 5 commits of the log
git log ABCDEF1..HEAD
git log ABCDEF1^..HEAD
list all commits from ABCDEF1 to HEAD
... including ABCDEF1
svn blame FILEgit blame FILE...
svn diff | less
svn diff -rREV PATH
git diff
git diff REV PATH
...
svn statusgit status...
svn revert PATHgit checkout PATH...
svn add PATHgit add PATH...
svn rm PATHgit rm PATH...
svn mv PATHgit mv PATH...
svn commit -m MMMgit commit -a -m MMM
git push origin [BRANCHNAME]
commit recursively to local repository, then push to remote (origin);
BRANCHNAME is optional if things are mapped correctly
svn commit FILESPEC -m MMMgit add [FILESPEC]
git commit -m MMM
git push origin [BRANCHNAME]
same, but only a single file (need to add it if there isn't commit -a)
branches
svn copy URL/trunk URL/branch/BRANCHNAMEgit branch BRANCHNAMEcreate a new branch
git push origin localbranch:remotebranchworking on localbranch on my machine, but want to push to a new branch at github (seen on CodingTrain)
git push origin -u remotebranchpush from my active local branch to new remotebranch at github, and link them
svn switch ^/branches/BRANCHNAMEgit checkout BRANCHNAME
or
git checkout -b BRANCHNAME origin/BRANCHNAME
switch working copy to the branch

(the second keeps it in sync with the remote BRANCHNAME)
git checkout -b BRANCHNAME
git push -u origin BRANCHNAME
switch working copy to new branch, then push the new branch to the origin
svn merge ^/branches/BRANCHNAMEgit merge BRANCHNAMEmerge changes from BRANCHNAME into local
svn list ./branches/git branchlist only local branches
svn list ^/branches/git branch -rlist only remote branches
svn list ./branches ^/branches/git branch -alist local and remote branches
git branch -vvlist branches with extra details;
ones with "gone" should be pruned
git fetch -p
git remote prune [-n] <name>
git branch -D <branchname>
prune deleted remote branches from branch -r/-a list, where name is normally origin; -n is same as --dry-run
git log BRANCHNAME --not mainlist all commits for the given branch, without including any from the main branch
git configuration
git config --global user.name VALUE
git config --global user.email VALUE
configure username/email for all repos (omit VALUE to read)
git config user.name VALUE
git config user.email VALUE
configure username/email for current repo to be different than the global setting (omit VALUE to read)
git config --global init.defaultBranch mainuse 'main' instead of 'master'
SVN_EDITOR=c:/usr/local/scripts/block++.batgit config --global git config --global core.editor "c:/usr/local/scripts/block++.bat"set editor for commit messages
git config remote.origin.prune trueautomatically prune deleted remote branches
git config --list
git config --list --global
list all configured options
misc
svn:externalsgit subtree mergesembed external repo links *
git reset --soft ABC1234
git commit -m "..."
git push -f origin
If you started at ABC1234, then did commits A1, B2, C3, D4, E5, this will "squash" them then do a force-push to get it to look like it went immediately from ABC1234 to E5A in a single commit instead of 5 commits.

references

page look-and-feel inspired by lifehacker.me