DEV Community

Cover image for Handy Commands For Developers
Ashish Mishra
Ashish Mishra

Posted on • Originally published at blank-slate.hashnode.dev on

Handy Commands For Developers

Chrome

Copy data to Clipboard

If you want to copy an object or variable to the clipboard from the console, then use the below copy command. The below line will copy AABB text to the system clipboard.

    copy("AABB");

Enter fullscreen mode Exit fullscreen mode

Couchbase

Scenario 1: Copy all documents from One Bucket to another

    INSERT INTO \`bucket-name\` (KEY _k, VALUE _v) SELECT META().id _k, _v from \`bucket-name\` _v

Enter fullscreen mode Exit fullscreen mode

Scenario 2: Deleting everything from bucket

    DELETE FROM \`bucket-name\`

Enter fullscreen mode Exit fullscreen mode

Git

Scenario 1: Need to remove a Modified File from Git pull request

Switch to the branch from which you created the pull request:

 git checkout pull-request-branch

Enter fullscreen mode Exit fullscreen mode

Overwrite the modified file(s) with the file in another branch, let's consider it's master :

git checkout origin/master -- src/main/java/HelloWorld.java

Enter fullscreen mode Exit fullscreen mode

Commit and push it to the remote:

git commit -m "Removed a modified file from pull request"
git push origin pull-request-branch

Enter fullscreen mode Exit fullscreen mode

Scenario 2: Update the commit user name and email in the respective Git repo.

git config user.name user-name
git config user.email username-git@gmail.com

Enter fullscreen mode Exit fullscreen mode

Scenario 3: Git updating the buffer size in Git repo, helps in case a large file is present in Git and you are trying to clone it in the local system.

git config --global http.postBuffer 1048576000

Enter fullscreen mode Exit fullscreen mode

Scenario 4: Stop tracking changes to a file in Sourcetree.

I guess This is the issue which troubled me most in git. Let's say, I have a file in my code base that I don't want to commit as this is specific to my local. But still, Sourcetree shows this file to me, every time I try to commit. This is really very annoying. to fix this run the below command in the repo folder and the Sourcetree will understand our feelings.

git update-index --assume-unchanged file.filename

Enter fullscreen mode Exit fullscreen mode

For folder use this

git rm -r --cached path_to_your_folder/

Enter fullscreen mode Exit fullscreen mode

To get undo/show dir's/files that are set to assume-unchanged run this:

git update-index --no-assume-unchanged file.filename

Enter fullscreen mode Exit fullscreen mode

To get a list of dir's/files that are assume-unchanged run this:

git ls-files -v|grep '^h'

Enter fullscreen mode Exit fullscreen mode

To delete all local checked out branches

git branch -D `git branch`

Enter fullscreen mode Exit fullscreen mode

Maven

Scenario 1: Start the AEM in debug mode

java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8765 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=256M -Xmx1024m -Dorg.apache.sling.commons.log.level=INFO -jar cq-quickstart-6.5.0.jar

Enter fullscreen mode Exit fullscreen mode

Scenario 2: Build and deploy AEM

mvn -PautoInstallPackage -Padobe-public clean install

Enter fullscreen mode Exit fullscreen mode

Scenario 3: Start the Spring boot application

mvn clean spring-boot:run

Enter fullscreen mode Exit fullscreen mode

Scenario 4: Start Spring boot in specific mode

mvn clean spring-boot:run -Dspring-boot.run.profiles=local

Enter fullscreen mode Exit fullscreen mode

Scenario 5: Skip J-Unit test

-Dmaven.test.skip=true

Enter fullscreen mode Exit fullscreen mode

Scenario 6: Start Spring boot in debug mode and also run a specific profile and skip j unit test compilation

mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" -Dspring-boot.run.profiles=local -Dmaven.test.skip=true

Enter fullscreen mode Exit fullscreen mode

Redis

Scenario 1: Start Redis Server

redis-server

Enter fullscreen mode Exit fullscreen mode

Scenario 2: Clear redis cache

redis-cli flushall

Enter fullscreen mode Exit fullscreen mode

To Be Continued....

Top comments (0)