git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
Adding it to the bash script
echo "alias gitl='git log --pretty=format:"%h%x09%an%x09%ad%x09%s"'" >> ~/.bashrc
From now on you can type:
3918a7c8 Vivek Bhadra Wed Oct 23 14:02:16 2019 +0100 Integrating the esp8266 wifi module in SPRESENSE sdk.
cbce5ee6 Vivek Bhadra Tue Oct 22 13:16:11 2019 +0100 Fixes.
d4fc23c7 Vivek Bhadra Wed Oct 16 16:01:03 2019 +0100 Enhanced camera App for better user interactivity.
6cc05f93 Vivek Bhadra Wed Oct 16 13:47:02 2019 +0100 Customized for delayed capture of 1 mins.
and see the formatted git log, change the format as you would like.
Checking your current git branch
git branch -av
Add it to the .bashrc
echo "alias gitb='git branch -av'" >> ~/.bashrc
* customize_for_12_demo 3918a7c8 Integrating the esp8266 wifi module in XYZ sdk.
master ee8f2ddf Merge pull request #41 from XXX/release-v1.4.1
remotes/origin/HEAD -> origin/master
remotes/origin/auto_build_doxygen a5681292 Updated readme and only build doc from master
remotes/origin/master ee8f2ddf Merge pull request #41 from XXX/release-v1.4.1
remotes/origin/release_1.0.1 ec7f3dab Release tag XYZ_1.0.001 YYY.0.001 release.
on the console to check the git branch you are on.
Creating a patch from multiple commits
git format-patch -x --stdout > patch-ddmmyyy.patch
git format-patch --ignore-space-change --ignore-space-at-eol --ignore-all-space -n --stdout > ~/patch4-LH3-18466-19092019.patch
where n is the number of commits you want to get back.
the above options are self-explanatory.
How to remove untracked files in git?
- Print out the list of files which will be removed (dry run)
git clean -n
- Delete the untracked files from the repository
git clean -f
How to not display the untracked files with git status?
git status --untracked-files=no
git status -uno
Renaming a local branch in command line
switch to the branch you want to rename
git checkout branch-name
Then rename it as below:
git branch -m new-name
Stop Ubuntu going into suspended mode
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Created symlink /etc/systemd/system/sleep.target → /dev/null.
Created symlink /etc/systemd/system/suspend.target → /dev/null.
Created symlink /etc/systemd/system/hibernate.target → /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null.
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
Clone SD card
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 465.3G 0 part /
sdb 8:16 1 29.7G 0 disk
├─sdb1 8:17 1 256M 0 part /media/vbhadra/boot
└─sdb2 8:18 1 14.6G 0 part /media/vbhadra/rootfs
sr0 11:0 1 1024M 0 rom
As can be seen above in my Ubuntu the SD card (which is attached to the PC using a SD card reader) has been detected in /dev/sdb which has two partitions /dev/sdb1 and /dev/sdb2. If you do not see the above your SD card might need some preparation, particularly it would require a formatting in FAT32 format. You can format your SD card following the instruction here. Remember there is no need to create the partitions yourself. Once you clone the whole Raspbian image into the SD card you would have these partitions already and use the SD card straight into a Pi. All you need is to format the SD card and create a big FAT32 partition occupying the whole card space.
$ sudo dd if=/dev/sdb of=raspbian.img bs=4M
7609+1 records in
7609+1 records out
31914983424 bytes (32 GB, 30 GiB) copied, 2414.63 s, 13.2 MB/s
To enable progress of dd command use status=progress along with the above command:
$ sudo dd if=/dev/sdb of=raspbian.img bs=4M status=progress
Copy disk image to SD card
Now, to do the opposite i.e. copying an image (e.g. raspbian) to SD card do the below:
$ sudo dd if=raspbian.img of=/dev/sdb bs=4M status=progress
Where raspbian.img is the name of the image you want to copy to the SD card, and in this case the image is in the current directory, otherwise you have to provide the absolute path of the image in the above command.
Recently my apt-get install didn’t work in Ubuntu 10.04 and I couldn’t spend time to fix the source list when it didn’t work straight forward.
Read More »
Sometimes you may want to take a snapshot of the current state of your virtual machine (in my case Ubuntu Linux) so that you can revert back to it if anything goes wrong in the virtual machine. The feature in VirtualBox which helps in this is called a snapshot.
A snapshot is basically a backup of your virtual machine in its current state.
Read More »
Suppose you have a local GIT repository where dev-stable-topic is the development branch and time to time the releases are made to the customer from a remote GIT repository which has a branch called release-stable from where the selective changes are merge in a controlled way. The remote repository is hosted in a separate linux server.
Read More »
Often you will encounter merge conflicts while doing rebase operation as described above.
Read More »
I was facing an issue recently and it is like this. I run a Ubuntu Linux Virtual Machine on a Windows guest. Because of my specific requirements I need to connect to a specific AP (wifi router) from a Windows machine.
Read More »