Git, Bitbucket & GitHub

What is Git: Git is a version control system. It was developed by Linus Torvalds(developer of Linux kernel) and Junio C Hamano. It was released in 2005. Git was developed by C, C++, Perl, Tcl, and Python.

Some other popular version control systems are:

  • Bitbucket
  • Gitlab
  • PerForce
  • Beanstalk etc.

Why Git?

  1. To control version
  2. To keep changed track
  3. To collaborate on a project from a different location

Create a personal access token for remote access.

  1. In the upper-right corner, click your profile photo then click Settings.
  2. In the left sidebar, click  Developer settings.
  3. In the left sidebar, under  Personal access tokens, click Token (Classic).
  4. Under the Token name, enter a name for the token.
  5. Under Expiration, select an expiration for the token.
  6. Select scopes. Scopes define access for personal tokens.
  7. Click Generate token.

Git Command

  1. To initialize git
git init

2. To see the status

git status

3. To pass all files in the staging stage

git add .

4. To commit all files

git commit -m "Commited first release"

5. To configure the username, email, and password of your bitbucket account in your local system

git config --global "YourBitbucketUsername"
git config --global ""
git config --global user.password "YourBitbucketpassword"

6. To upload the project to the Bitbucket repository

 git remote add origin

git push -f origin master

7. Creating a Branch

git branch branchname

8. Moving from the current branch to another branch

git checkout branchname

9. pull the project from Bitbucket. Note that pull is the combination of fetch and merge

Note that here the destination link part will be found in the created repository in the Bitbucket clone option

git pull

10. PUSH the project into Bitbucket

git push

Remote access in Git using the personal access token

git remote remove origin
git remote add origin https://[TOKEN][REPO-OWNER]/[REPO-NAME]
git push --set-upstream origin master