From 34f94985b7c038d620da320c2edb927824f6a833 Mon Sep 17 00:00:00 2001 From: Yi Luo Date: Sat, 3 Feb 2018 14:31:18 -0800 Subject: [PATCH] Added git.txt cmake_build.txt Change-Id: I0c33a690b97a6ae121ce2b639cb2644247fbb587 --- scripts/cmake_build.txt | 28 +++++++++ scripts/git.txt | 132 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 scripts/cmake_build.txt create mode 100644 scripts/git.txt diff --git a/scripts/cmake_build.txt b/scripts/cmake_build.txt new file mode 100644 index 000000000..c7b7ec224 --- /dev/null +++ b/scripts/cmake_build.txt @@ -0,0 +1,28 @@ + +Regular build +rm -rf ./* && cmake ../.. -DENABLE_WERROR=1 && make -j + +Debug build without optimizations (can be used for Eclipse debugging): +(Implies --disable-optimizations) + +rm -rf ./* && cmake ../.. -DENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug && make -j + +Debug build with optimizations on (should be used for performance analysis): +rm -rf ./* && cmake ../.. -DENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE='-O3 -g' -DCMAKE_CXX_FLAGS_RELEASE='-O3 -g' -DCMAKE_LD_FLAGS_RELEASE='-O3 -g' && make -j + +Build with ASAN: +rm -rf ./* && cmake ../.. -DSANITIZE=address -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=1 && make -j + + +Build with TSAN + +rm -rf ./* && cmake ../.. -DSANITIZE=thread -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug && make -j + + +Build with UBSAN + +rm -rf ./* && cmake ../.. -DSANITIZE=integer -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS=-O1 -DCMAKE_CXX_FLAGS=-O1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXE_LINKER_FLAGS=-Wl,--start-group -DENABLE_CCACHE=1 && make -j + + +rm -rf ./* && cmake ../.. -DSANITIZE=undefined -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS=-O1 -DCMAKE_CXX_FLAGS=-O1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXE_LINKER_FLAGS=-Wl,--start-group -DENABLE_CCACHE=1 && make -j + diff --git a/scripts/git.txt b/scripts/git.txt new file mode 100644 index 000000000..f6f0ec50f --- /dev/null +++ b/scripts/git.txt @@ -0,0 +1,132 @@ +######################################################### +# My personal GIT tips +######################################################### + +(1) Squash several commit into one (consolitation) +# Note: +# Between HEAD and 3 is tilde sign +$ git rebase -i HEAD~3 +# step 1: In pop-up editor (emacs), "pick" the earliest one and squash all the rest. +# step 2: In second pop-up editor, edit the commit message and save, exit. + + +(2) Pull the latest changes (sometime it is a fix/required) and put it under +# your working commit +$ git pull --rebase +# if there are any conflicts, you need edit the conflicted files manually. then +$ git add +$ git rebase --continue + +# Note: Don't do git commit between "git add" and "git rebase --continue", + if you did, then you need git rebase --abort and come over. + +# Another way (?) from Su Hui +$ git fetch +$ git rebase -i origin/nextgenv2 +# -i ?, the following works: +$ git rebase origin/nextgenv2 +# if there are any conflicts, you need edit the conflicted files manually. Sometimes +# need to diff against change in another repos or blame the conflict file to see the +# change. +$ git add +$ git rebase --continue + + +(3) Create a branch from a older commit +# Create a branch from the top and specify the targeted remote branch +# Typically I need to create a branch for new code construction +$ git checkout -b + +# Typically I need to create a branch for performance test base (seat) +$ git checkout -b + + +(4) Restore the local top to +# Delete the current top commit +$ git reset --hard + +# Delete the current failed merge/modification +$ git reset --hard + + +(5) Diff a commit against its parent +$ git diff ^! + +# Diff HEAD agaist its parent +$ git diff HEAD^! + + +(6) Restore one file from previous commit and fix latest commit +$ git checkout +$ git commit --amend + + +(7) Merge a commit from master branch to another branch +$ git checkout +# use cherry pick. Please make sure the is clean and latest +$ git fetch https://chromium.googlesource.com/webm/libvpx refs/changes/18/336818/3 && git cherry-pick FETCH_HEAD +# if there is no conflict, it automatically merge (if successfull) with local. And +# the commit appears if do "git log" +# if there is conflict, need to merge manually and $ git commit -a --amend (i guess) + + +(8) Cherry pick +# This way we add an extra line (reference to the picked commit) +$ git cherry-pick -x + + +(9) Sandbox push +First ask Admin to create a sandbox (remote branch) for you. +# Work in local from git init, git commit .... +# Initial push: +# Here we use "head" instead of "for", "for" is for review board. Please note: +# we use -f +$ git push -f https://chromium-review.googlesource.com/webm/libvpx HEAD:refs/heads/sandbox/luoyi@google.com/convolve +$ git checkout -b sandbox/luoyi@google.com/convolve + +# check it out: +$ git checkout -b codestore origin/sandbox/luoyi@google.com/convolve + +# Push +# Run git push, then the error message would show you two ways. The first way works. See following: +$ git push origin HEAD:sandbox/luoyi@google.com/convolve + +(10) Revert a change +$ git checkout +Revert a file at to index + +(11) Diff current staged file (ready to commit) against a previous commit version +$ git diff --cached + +(12) Setup a branch for continuing work +# On a branch named: branch_name1, +$ git checkout -b +$ git branch -u origin/nextgenv2 +# latest commit may not be merged yet. So after local check-in, can we do + cherry-pick later from branch_name2 to branch_name1? + +(13) Generate and Apply a patch +$ git diff --no-ext-diff > my.diff +$ git apply my.diff + +(14) git log --pretty=format:"%h %an %cd %s" --date=short + git log --pretty=fuller + +(15) git rebase -i origin/master + Remove current unwanted base patch + Pull in latest patches + +######################################################## +# Trivial tips now +######################################################## +(1) Push for a review +$ git push https://chromium-review.googlesource.com/webm/libvpx HEAD:refs/for/nextgenv2 +or +$ review_push.sh + +(2) Show git remote repo +$ git remote show origin + +(3) Check codebase's tag information +$ git tag +$ git rev-list -n1 v0.1.0 -- 2.49.0