- Git global user setup
- Create a new repository
- Init repository in existing folder
- Bind remote repository with local one
- Switch existing Git repository
- Store credentials
- Revert commit
- Case sensitive file names
- Transfer a gist to a GitHub repository
git config --global user.name "Dmytro Zarezenko"
git config --global user.email "[email protected]"
git clone https://github.com/dzarezenko/devTips.git
cd devTips
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
cd existing_folder
git init
git remote add origin https://github.com/dzarezenko/devTips.git
git add .
git commit -m "Initial commit"
git push -u origin master
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/dzarezenko/devTips.git
git pull origin master --allow-unrelated-histories
git push -u origin master
cd existing_repo
git remote rename origin old-origin
git remote add origin https://github.com/dzarezenko/devTips.git
git push -u origin --all
git push -u origin --tags
For temporary store credentials in memory use:
git config --global credential.helper cache
For permanent store use:
git config --global credential.helper store
After that use:
git config --global credential.https://github.com.username github
or
git config --global credential.https://[email protected] bitbucket
Then clone repository and type password when it will ask you.
More details:
gitcredentials
- providing usernames and passwords to Git- How to provide username and password when run
git clone [email protected]
?
Revert last commit locally:
git reset --soft HEAD~1
Apply revert on the remote repository:
git push -f origin local_branch_name:remote_branch_name
More information:
- What is difference between
git reset --hard HEAD~1
andgit reset --soft HEAD~1
? git-reset
- Reset current HEAD to the specified state
To tell Git to be case-senstive, simply set this setting to false
...
git config core.ignorecase false
Remove a file from a Git repository without deleting it from the local filesystem.
git rm --cached filename.ext