windows git-bash: cancel git-commit –amend

shows q(:cq) is the vi command to kill the pending commit

q(:q!) didn’t cancel the commit.


github tips #basic

  • q(git config credential.helper store) is the command that finally fixed my git-bash forgetting-password problem on my win7 Dell. The github recommended command only worked in my win10 Lenovo and office win7:
    • git config --global credential.helper wincred 
  • –to download an entire branch on the github web interface: CloneOrDownload button can download a zipfile
  • –to mass upload using drag-n-drop
  • I realize that the zipfile downloaded has a problem. When I open the zipfile (but not extract) and select the files, the drag-n-drop interface fails. I had to copy the files to a tmp directory.
  • –delete folder: not so easy
  • –rename file @web interface is easy
    • checkout branch locally,
    • rename branch
    • commit
    • push, which triggered a login pop-up.–rename branch: no web interface. I had to
  • –rename folder: no web interface. I had to
    • git mv dir1 com/xx/dir1
    • git commit
    • git push

q(-c) flag in g++

$ cat main.cpp:

void aa();
int main(){aa();}

g++ command without “-c” would try to create an executable but the “aa()” is declared not defined.

You can either user “-c” or

g++ lib1.o main.cpp # to link in the aa() definition from lib1.o


diff two checked-out dir from same branch

Challenge (common problem for developers) : locate a breaking commit in a long history

More than once, I have found  great value in checking out two copies from the same branch. Need to compare the two directories recursively.

diff -w -r -x CVS -x shared -x lib -x *.o -x '*.b4vtanedit*' aquis aquis1 | less -E

gdb cheatsheet

#1 tip:
gdb –tui # starts an upper screen showing a moving marker against the current line. If you started gdb without “–tui”, you can still use Ctrl-X Ctrl-A.

#2 tip:
After hitting a breakpoint, you can use q(n) i.e. q(next) and just Enter to repeat previous q(n).

I found it easier to use q(break filename:lineno) # Filename doesn’t need full path J

Other essential commands

  • · info break # or info b to list all breakpoints
  • · bt # or backtrace
  • · frame 0
  • · list
  • · p for print
  • · info variables
  • · info locals
  • · info args
  • · n # for step-over
  • · s # for step-in
  • · fin # for step-out
  • ctrl-L toclear gdb command screen

cvs rollback #basics

cvs -q update -D “2017-07-29” # will remove any file that’s “not in the universe” at that moment in history

The date means beginning of the day in GMT.  Here’s the more precise form:

cvs -q up -D “2017-07-29 00:00:01 GMT”

cvs -q up -D ‘2017/09/15 19:54:25 GMT’ # GMT make a difference. Default is … surprise.

–To verify the rollback

  • cvs log # is confusing and shows commits after the snapshot!
  • cvs stat path/to/file # shows the sticky tag

–To check the commits between two dates:

cvs diff -N -b -D “2017-10-20 22:00:00 GMT” -D “2017-10-20 23:00:00 GMT”


## rpm cheatsheet

rpm -qp –scripts /path/to/rpm/file # reveals the scriplets embedded

rpm -qp -lv nysemkt_integrated_parser-cfg-1.0.2-1.noarch.rpm # list files


gdb –tui #split screen

You can also start gdb normally, then switch to split screen, with “ctrl-x  ctrl-a” (thanks to Gregory).

Upper screen shows the source code with a moving marker

–Here’s my full gdb command showing

  • –args to run the target executable with arguments
  • redirect stderr to a file so my gdb screen isn’t messed up — not always effective

gdb –tui –args $base/shared/tp_xtap/bin/xtap -D 9 -c $base/etc/test_replay.cfg 2 >


cvs update/checkout a file or dir

–retrieve an old version without sticky

cvs up -p -r1.17 CTFXdpIntgPlugin.C> CTFXdpIntgPlugin.C.1.17

–cvs update a dir or file:

cvs update –dA package/aida/common/script Bring working dir specified up to date with the repository (merge changes made to the repository into the local files).
cvs update –A package/aida/common/script/MakefileAida.sun4
Bring just the named file up-to-date with the repository

–cvs checkout a dir or file:

cvs checkout edu Checks out everything under edu, placing an edu directory, plus all subordinate subdirectories, in the working dir.
cvs checkout app/alh Checks out everything under app/alh placing an app directory in your working directory, but only the alh subdirectory of app.
cvs co package/aida/common/script/MakefileAida.sun4
Checks out only the single file MakefileAida.sun4, creating package/aida/common/script/MakefileAida.sun4 in the working directory, containing that one file.

q(g++ -g -O) together has a section specifically on debugging. It says

GCC allows you to use -g with -O

I think -g adds additional debug info into the binary to help debuggers; -O turns on complier optimization.

By default, our binaries are compiled with “-g3 -O2”. When I debug these binaries, I can see variables but lines are rearranged in source code, causing minor problems. See my blog posts on gdb.