A personal collected reusable functions
- Binary Converter uint32_t x -> uint8_t *lit_int
- msgpack usage(map) pack of pack
- WinGetEnv - Environment Vaiable Dir get method
- Dup - Print into a file
- Remove new lines in char string
- Regex - Find All Except a Specific Word
- Windows Startup Link
- Windows Connectivity Changed
QT
https://help.github.com/en/articles/changing-a-remotes-url
https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key
https://www.git-tower.com/blog/content/posts/54-git-cheat-sheet/git-cheat-sheet-large01.png
-
Git: On undoing, fixing, or removing commits in git https://sethrobertson.github.io/GitFixUm/fixup.html#discard_all_unpushed
Removing the last commit
To remove the last commit from git, you can simply rungit reset --hard HEAD^
If you are removing multiple commits from the top, you can rungit reset --hard HEAD~2
to remove the last two commits. You can increase the number to remove even more commits.If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard":
git reset HEAD^
which will evict the commits from the branch and from the index, but leave the working tree around.If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.
https://stackoverflow.com/questions/3876977/update-git-branches-from-master/28505516
https://stackoverflow.com/questions/6245570/how-to-get-the-current-branch-name-in-git?rq=1
Create New Branch
https://remarkablemark.org/blog/2017/06/02/git-update-branch/
https://www.git-tower.com/learn/git/faq/detached-head-when-checkout-commit https://stackoverflow.com/questions/9237348/what-does-fetch-head-in-git-mean
git bisect start
git bisect bad --id
git bisect good --id
git bisect good/bad
git bisect reset
https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase
https://stackoverflow.com/questions/15286075/difference-between-git-stash-pop-and-git-stash-apply
git stash pop throws away the (topmost, by default) stash after applying it, whereas git stash apply leaves it in the stash list for possible later reuse (or you can then git stash drop it).<br>
This happens unless there are conflicts after git stash pop, in which case it will not remove the stash, leaving it to behave exactly like git stash apply.<br>
Another way to look at it: git stash pop is git stash apply && git stash drop<br>
- Configure a remote for fork
- Syncing a fork
https://www.atlassian.com/git/tutorials/git-forks-and-upstreams - Push Commits
Possible SSH ERROR
sign_and_send_pubkey: signing failed: agent refused operation git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
Solution
- https://askubuntu.com/questions/762541/ubuntu-16-04-ssh-sign-and-send-pubkey-signing-failed-agent-refused-operation
- https://www.ssh.com/ssh/add
- https://stackoverflow.com/questions/44250002/how-to-solve-sign-and-send-pubkey-signing-failed-agent-refused-operation
- Git pull (with rebase)
git pull --rebase
You must run two commands:
git submodule init
to initialize your local configuration file,
and
git submodule update
to fetch all the data from that project and check out the appropriate commit listed in your superproject
There is another way to do this which is a little simpler,
If you pass --recurse-submodules to the git clone command,
it will automatically initialize and update each submodule in the repository,
including nested submodules if any of the submodules in the repository have submodules themselves.
If you already cloned the project and forgot --recurse-submodules,
you can combine the git submodule init and git submodule update steps by running
git submodule update --init.
To also initialize, fetch and checkout any nested submodules, you can use the foolproof
git submodule update --init --recursive.
Update Submodules From upstream
git submodule update --remote,
Git will go into your submodules and fetch and update for you.
Patch file
https://gist.github.com/zeuxisoo/980174
There are actually three things here: origin master is two separate things, and origin/master is one thing.
Three things total.
Two branches:
master
is a local branchorigin/master
is a remote branch (which is a local copy of the branch named "master" on the remote named "origin")
One remote:
origin
is a remote
$ git commit -m "Something terribly misguided" # (1)
$ git reset HEAD~ # (2)
<< edit files as necessary >> # (3)
$ git add ... # (4)
$ git commit -c ORIG_HEAD # (5)
Vs Debug
https://git.jami.net/savoirfairelinux/ring-project/issues/724#note_16719
gdb --args (binary)
r
stop program
break(b) full_filepath:line
r(restart)
Control + X + A(UI thread backtrace(bt))
up/down/step
info b
thread apply all bt
https://www.thegeekstuff.com/2014/02/gdb-breakpoins-watchpoints/
#pragma optimize( "", off )
Command History
To get previous command containing string, hit [CTRL]+[r] followed by search string
find src/ -regex '.*.(cpp|hpp|cu|c|h)' -exec clang-format -style=file -i {} \;
gflags.exe /p /enable <executable> \full
/Od /Oy