Skip to content

MingruiZhangW/Useful-Function-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useful-Function-Database

A personal collected reusable functions

QT

Set Remote

https://help.github.com/en/articles/changing-a-remotes-url

SSH KEY

https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key

Git

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 run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git 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.

Git Current Branch Name & Update brach

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/

Git Detached Head/Fetch Head

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 - Find the commit that cause the bug

Git bisect

git bisect start
git bisect bad --id
git bisect good --id
git bisect good/bad
git bisect reset

Git - Origin Definition

Git - what is origin

Git - Delete Folder

https://github.community/t5/How-to-use-Git-and-GitHub/How-to-delete-multiples-files-in-Github/td-p/4623

Git - Rebase

https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase

Git - stash apply vs stash pop

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>

Git - Configure a fork & How to update/push to fork

sign_and_send_pubkey: signing failed: agent refused operation git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Solution

Git - update repo content

Git - Submodules

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.

Git - Move Files

Move Files

Git - Patch file (apply diff file)

Patch file
https://gist.github.com/zeuxisoo/980174

Git - Difference between origin master and origin/master

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 branch
  • origin/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

Example

Git Three Tree (staging index, working directory, commit history) and Git Reset

Link

Git - Undo a commit and redo

$ 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)

Debug

Using Visual Studio to attach processes

Vs Debug
https://git.jami.net/savoirfairelinux/ring-project/issues/724#note_16719

GDB Breakpoint insert

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

GDB - Watch point

https://www.thegeekstuff.com/2014/02/gdb-breakpoins-watchpoints/

Debug - Turn off Optimizitaion

#pragma optimize( "", off )

Install - Apply WSL Terminal

WSL

Check Command History

Command History
To get previous command containing string, hit [CTRL]+[r] followed by search string

Strike through Example

PPI Vs DPI

PPI vs DPI

Docker Introduction

Docker 入门

VC++

Functional-level Linking

Clang-format

find src/ -regex '.*.(cpp|hpp|cu|c|h)' -exec clang-format -style=file -i {} \;

Gflags

gflags.exe /p /enable <executable> \full

/Od /Oy

About

Dumping things

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published