Files
git/README.md
2024-03-09 10:07:06 +00:00

702 B

git

discard local changes

#all unstaged files in current working directory
git restore .

#specific file
git restore PATH/FILENAME

change origin url

git remote set-url origin <origin-url>

Create new branch from uncommited

git switch -c <new-branch>

# or

git checkout -b <new-branch>

Credentials

git config --global credential.helper cache

# Cache for 1 hour
git config --global credential.helper "cache --timeout=3600"

# Cache for 1 day
git config --global credential.helper "cache --timeout=86400"

# Cache for 1 week
git config --global credential.helper "cache --timeout=604800"