List of Useful Git Commands

Here are some everyday Git commands:

git status

Check the status of your Git

git checkout

Check the checkouts.

git remote -v

See what remotes are defined. If you did a Git clone these remotes will already be specified.

arb@cp1 bitcoin-spread]$ git remote -v

origin https://github.com/eugenevdm/bitcoin-spread (fetch)

origin https://github.com/eugenevdm/bitcoin-spread (push)

git remote add origin 

You only use the above and if you don’t remotes already

git branch -r

[arb@cp1 bitcoin-spread]$ git branch -r

  origin/HEAD -> origin/master

  origin/master

Git Fetch and Git Pull are particularly useful if you’re working on localhost and then you want to sync with a remote server. First commit and push on localhost, and then fetch and pull on remote server.

[arb@cp1 bitcoin-spread]$ git fetch

remote: Enumerating objects: 13, done.

remote: Counting objects: 100% (13/13), done.

remote: Compressing objects: 100% (5/5), done.

Unpacking objects: 100% (8/8), done.

remote: Total 8 (delta 3), reused 8 (delta 3), pack-reused 0

From https://github.com/eugenevdm/bitcoin-spread

   32630a1..afd1c33  master     -> origin/master

[arb@cp1 bitcoin-spread]$ git pull

Updating 32630a1..afd1c33

Fast-forward

 app/Console/Commands/{UpdateCommand.php => UpdateSpreadCommand.php} | 9 ++++++—

 app/Console/Kernel.php                                              | 2 +-

 credentials.json                                                    | 1 +

 token.json                                                          | 1 +

 4 files changed, 9 insertions(+), 4 deletions(-)

 rename app/Console/Commands/{UpdateCommand.php => UpdateSpreadCommand.php} (74%)

 create mode 100644 credentials.json

 create mode 100644 token.json

 

Tags

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top