- Remove a file/directory in the repo but not locally:
git rm --cached filepath
git rm --cached -r directory_path
- To undo adding a file or directory:
- Start a bitbucket repo with existing project in local directory
- create a repo with ${repo_name} in bitbucket web
cd your_project_path
git init
git remote add origin git@bitbucket.org:${user_name}/${repo_name}.git
- do git operations as needed
- for example,
git pull origin master
- for example,
git commit -m ${commit_message}
git push -u origin master
- Show command history in a Windows cmd window
DOSKEY /history
- Remove from repo but keep the local files:
git rm --cached -r [dir|file]*
- Make sure your ssh works
- ``eval `ssh-agent -s```
- then do
ssh-add
- then verify what has been added using
ssh-add -l
- You will also be able to test out the connection using
ssh -T git@bitbucket.org
- Download
myssh1.zip
from Google email - Unzip and move the content of the zip file over to
~/.ssh
. - Make sure the
id_rsa
permission is right:chmod 400 id_rsa
.
- Git ignore file for java project:
# Eclipse
.classpath
.project
.settings/
# Intellij
.idea/
*.iml
*.iws
# Mac
.DS_Store
# Maven
log/
target/
If you place this in .gitignore
the root directory of your project, the ignore settings will be applied to all sub-directories automatically.
- With Intellij IDE
- Actually, once you are done to step #2.4, the IDE will pick up the Git integration, and you can do all the add, commit, and push operations within the IDE.
- How to undo almost everything in Git
- Protocols to choose from when cloning
- Change remote url of a local git repo:
git remote rename origin backup
git remote add origin git@company:user/repo.git