git log # commit id for 2 commits
git commit_id1 commit_id2 -- file
git rm <file-name>
git checkout <commit_ID> path/to/the/file.txt
git reset HEAD~n
to reflefct the deleted commit on remote:
git push --force
git checkout filename
git stash
git pull
git stash clear
git config --global core.excludesfile '~/.gitignore'
echo '.ipynb_checkpoints' >> ~/.gitignore
*.DS_Store*
dist/*
target/
lib_managed/
src_managed/
/.idea/
__pycache__
*.class
git rm file2.txt /path/to/the/file --cached
git rm folder/* --dry-run
doing just rm
deletes the files from file system as well
The git is cloned via https, change it to ssh:
git remote set-url origin git@github.com:username/repo.git
git commit --amend