SourceTree’s equivalent git commands
- Clone
git clone <url>Cloning a remote repository into our local file system can be done this way.
2. Initialization
cd <dir_name>
git initThis will create a local git repository, which we can push later to remote server
You can also add template of a project, which will copy the folder structure into your newly created local repo
git init <directory> --template=<template_directory>3. Fetch
git fetchFetches all the commits from remote to local working copy
git fetch <branch_name>Fetches all the commits from just the specified branch
4. Pull
git pull <remote>Fetches the commit from remote and merges them with local working copy
git fetch <remote>
git merge origin/<current_branch>This does the same work as git pull <remote>
5. Push
git push <remote> <branch_name>Push the local changes to remote repository
6. Branch
git branch
> lists out the branched in given repo
git branch <branch_name>
> create a branch with a given nameAlthough creating a branch doesn’t implicitly checks out that branch.
This can be done using
git checkout -b <new-branch>7. Checkout
git checkout <branch_name>checks out a remote branch and merges it with local copy
8. Merge
git merge <branch_name> <feature_branch_name>Merges the feature branch into a branch
Suggested Reading : Difference between rebase and merge
9. Tag
git tagLists out all the tagged commits alphabetically.
git show <tag_name>Shows the tagger information and other metadata associated
git tag -a vX.YY -m "your message here"Creates tag on the head with specified tag and message
git tag -a vX.YY <commit_checksum>This will add tag to a previous commit