Git Hacks

Whenever you do git pull and you find some files modified locally as part of build and want to overwrite it with the contents in the git repository.

git checkout HEAD^ file/to/overwrite
git pull

To checkout a new git branch and to create a new git branch and checkout

git checkout <branch>

git checkout -b <branch>

To delete a remote branch and local branch

git push –delete origin bugfix/
git branch -d bugfix/

To copy a directory without its history and add as a new folder in git

cp -R old_dir new_dir

git add new_dir

git commit -m "first revision of new_dir's copied files"

Creating a diff file

git diff > 1.patch

Applying a git generated patch file

git apply 1.patch

Saving your changes while checking out a branch

git stash save

if you have to save again

git stash save

stash@{1} – older changes…newest will become stash{0}

git stash list – lists all stash

git stash drop

stash@{0} dropped. stash@{1} will become stash@{0}

git stash apply stash@{2} – to apply changelist in stash{2}

git stash drop stash@{2} – to drop the changelist in stash{2}

git stash pop - To get everything back
git checkout -b newbranch
git stash pop

git stash pop - Restore back to the saved state, but it deletes the stash from the temporary storage.
git stash apply - Restore back to the saved state and leaves the stash list for possible later reuse. Need to use below command to drop them.
git stash drop

git stash apply 1 is equal to git stash@{1} apply

Best SSD Buying Guide: NVMe, M.2, PCIe, SATA and SAS

What is the best solid state drive on the market? What is the fastest SSD? What is the best buy SSD? We answer these complex questions this buying guide.

Solid state drives (SSDs) are now available in multiple form factors, capacities, speeds, functions and price ranges. Smaller PCIe and M.2. form factors that can move the power of flash closer to the CPU.


Source: Best SSD Buying Guide: NVMe, M2, PCIe, SATA and SAS

Page 3 of 181
1 2 3 4 5 181