🌿Git
Initialisation/Starting
Init a repository
git initAdding a Git remote
# add using ssh
git remote add origin [email protected]:path/to/repo.git
# add using https
git remote add origin https://github.com/paht/to/repo.gitChange URL of Git remote
git remote set-url origin [email protected]:/path/to/repo.gitClone a repository
# this will clone into a new directory named 'repo'
git clone github.com/path/to/repo.git
# this will clone into the current directory
git clone github.com/path/to/repo.git .Development
Adding an item to the Git repository
# add everything in the current directory
git add .
# add a specific file
git add ./path/to/fileRemove an item from the Git cache
# remove a file
git rm --cache ./path/to/file
# remove a directory
git rm -r --cache ./path/to/directoryCreating a new branch
git checkout -b branch-nameRebasing from master
git checkout target-branch && git rebase masterSquashing commits
# squash ${N_COMMITS} commits into one commit
git rebase -i HEAD~${N_COMMITS};Release
Listing all Git tags
git tag --listAdding Git tag to current commit
git tag v1.2.3Last updated
Was this helpful?