Logo TheBeArsenal

Git | Technical Handbook

List all changed files in Git.

git diff --name-only

How to checkout from remote tag in Git?

Use command - 'git checkout tags/ -b '

Set git username and email in terminal

1. git config --global user.name "Name"
2.git config --global user.email "email@domain.com"

Sourcetree stopped opening on Windows 10


Please try again after deleting these random folders in the following path:


How can I delete all local Git branches except for the 'develop' branch?


To delete all local Git branches except for the develop branch, you can use the following steps:

  1. Open your terminal.
  2. Navigate to your Git repository.
  3. Run the following commands:
git branch | grep -v "develop" | xargs git branch -d

If you also want to include remote-tracking branches, use:

git branch -r | grep -v "develop" | sed 's/origin\///' | xargs -I {} git branch -d {}

This will:

  1. List all branches using git branch.
  2. Exclude the develop branch from the list using grep -v "develop".
  3. Delete the remaining branches using xargs git branch -d.

Note: The -d flag will only delete branches that have been fully merged. If you have unmerged branches and want to force delete them, use the -D flag instead of -d. Be cautious with this as it will delete branches regardless of their merge status.