Skip to content

Instantly share code, notes, and snippets.

@hoangnt2601
Last active August 25, 2022 04:10
Show Gist options
  • Select an option

  • Save hoangnt2601/1fa390791a00b292f09c01aed5018949 to your computer and use it in GitHub Desktop.

Select an option

Save hoangnt2601/1fa390791a00b292f09c01aed5018949 to your computer and use it in GitHub Desktop.
special git command
  • Add only modified changes and ignore untracked files
git ls-files --modified | xargs git add
  • Stash the changes in a dirty working directory away
git stash save
git stash apply [index]
  • error: insufficient permission for adding an object to repository database .git/objects
cd /path/to/project
sudo chown -R "${USER:-$(id -un)}" .
  • remove submodule in project
git rm --cached pathtosubmodule
  • git submodule
git submodule add ssh://git@git.github.git
git submodule update --init --recursive
git submodule update --remote --merge
  • git log
git log --pretty=oneline --abbrev-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment