( fast version control )
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems.
git init
git clone branch-name
“git clone” command and specify the copied URL to clone the selected Git repository.
git fetch --all
we have used the “–all” flag which will fetch all metadata of branches.
To display all remote branches, execute the “git branch” command:
git branch -r
In the above-mentioned command, the “-r” indicates the remote branches. As you can see, currently, we have three branches in the remote repository
git pull --all
shows that all remote branches are successfully pulled
git checkout -b branch-name
Example
git checkout -b feature
Switched to new branch 'feature'
⭕️ You can inspect existing branches by running the “git branch” command with the “-a” option for all branches.
git branch -a
⭕️ To get commits SHA from your history, you have to use the “git log” with the “–oneline” option.
git log --oneline --graph
git branch --delete branchname
master is now named develop
If you have a local clone, you can update it by running the following commands.
git branch --delete branchname
Now, create and switch to the new branch using the provided command.
git switch -c branch-name
git branch -a
“git branch” to display all branches with the help of the “-a” flag.
git push –set-upstream origin branch-name
git push –set-upstream origin branch-name” command. This blog demonstrated the method to push a new Git branch to the remote repo on GitHub.
git log
The commit history can be viewed in different ways by using the `git log` command. A local repository named bash has been used in this tutorial to test the commands used in this tutorial
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/master branch-name