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?
- To control version
- To keep changed track
- To collaborate on a project from a different location
Create a personal access token for remote access.
- In the upper-right corner, click your profile photo then click Settings.
- In the left sidebar, click Developer settings.
- In the left sidebar, under Personal access tokens, click Token (Classic).
- Under the Token name, enter a name for the token.
- Under Expiration, select an expiration for the token.
- Select scopes. Scopes define access for personal tokens.
- Click Generate token.
Git Command
- 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 user.name "YourBitbucketUsername"
git config --global user.email "YourEmail@gmail.com"
git config --global user.password "YourBitbucketpassword"
6. To upload the project to the Bitbucket repository
git remote add origin https://Nazimmamun@bitbucket.org/nazimtestdev/first-repo.git
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 https://Nazimmamun@bitbucket.org/nazimtestdev/first-repo.git
10. PUSH the project into Bitbucket
git push https://Nazimmamun@bitbucket.org/nazimtestdev/first-repo.git
Remote access in Git using the personal access token
git remote remove origin git remote add origin https://[TOKEN]@github.com/[REPO-OWNER]/[REPO-NAME] git push --set-upstream origin master