git config --global --list
Use for project agnostic/global gitignore files specific to a developer's setup.
Example contents:
.vscode/
touch ~/.gitignore
git config --global core.excludesfile ~/.gitignore
git config --global --add --bool push.autoSetupRemote true
git checkout OTHERBRANCH -- path/to/file
Add executable permissions to a file and track in git.
git update-index --chmod=+x script.sh
Undo last commit and move the files back to untracked.
git reset HEAD~
To restore a submodule to its original committed state:
git submodule update --init
# Update submodule
cd [submodule directory]
git checkout OTHERBRANCH
git pull
# Commit submodule hash change to main project
cd ..
git add [submodule directory]
git commit
git pull origin main --rebase
git push --force
- From the forked project, add the upstream project
git remote add upstream [email protected]:UPSTREAM-PROJECT.git
- Retrieve upstream changes to main
git fetch upstream
git rebase upstream/main
- Push changes to your forked main
git push