Most Useful Git commands for Terminal use

Most Useful Git commands for Terminal use

Downloads an Existing Git repository to your local computer.

Git
git clone

// Example: git clone https://github.com/user/git-url.git

The “clone” command downloads an existing Git repository to your local computer. You will then have a full-blown, local version of that Git repo and can start working on the project.

Typically, the “original” repository is located on a remote server, often from a service like GitHub, Bitbucket, or GitLab). That remote repository’s URL is then later referred to as the “origin”.

** Example::
In its simplest (and most common) form, only the repository URL is specified:

cd folder/to/clone-into/

This will download the project to a folder named after the Git repository (“git-crash-course” in this case). If you want a different folder name, simply specify it as the last parameter:

git clone https://github.com/user/git-url.git

This will download the project to a folder named after the Git repository (“git-crash-course” in this case). If you want a different folder name, simply specify it as the last parameter:

git clone https://github.com/user/git-url.git other-name

# Update <MyBranch> with Local


Update with Local Branch

Check current Branch:

git branch

Checkout the <MyBranch>

git checkout MyBranch

Check Status of Files:

git status

Add changes files

git add .

Commit Changes Files:

git commit -m "Any Message againt update"

Update Git repository:

git push

# Update Master with <MyBranch>

Update Master with

merge master branch with current branch:
(Currently on branch development)

$ git merge master

** here, After merge master if any merge conflicts found, resolve conflicts here & run check if it is ok.

Checkout Master:

git checkout master

Merge into Development branch:

(now, there won’t be any conflicts in Master as solved in development branch)

git merge development

git merge development 

or, Merge Branch Development with master Branch with a Commit Message

git merge <development> --commit -m "merge branch development to master"

1 thought on “Most Useful Git commands for Terminal use

Leave a Comment