Git Product home page Git Product logo

git's Introduction

imran baitham

Star the repo like and share 🙏

😍 Git

( 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.

imran baitham

Git Init

git init

Git Clone

git clone branch-name

“git clone” command and specify the copied URL to clone the selected Git repository.

Fetch all branchs

 git fetch --all

we have used the “–all” flag which will fetch all metadata of branches.

List Remote 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

pull --all

git pull --all

shows that all remote branches are successfully pulled

1. Create Git branch using checkout

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 Delete Branch

git branch --delete branchname

The default branch has been renamed!

master is now named develop
If you have a local clone, you can update it by running the following commands.

git branch --delete branchname

Step 4: Create and Switch Branch

Now, create and switch to the new branch using the provided command.

 git switch -c branch-name

Step 5: List Branches

 git branch -a

“git branch” to display all branches with the help of the “-a” flag.

Step 6: Push Git Branch to Remote Repo

 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.

Step 7: View commit history

 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

Mearge local to main branch

If you wish to set tracking information for this branch you can do so with:

 git branch --set-upstream-to=origin/master branch-name

git's People

Contributors

imran-baitham avatar

Stargazers

Rashid ali avatar Asifa Zehra avatar Zahid Hussain avatar Coder avatar  avatar Haider Abbas avatar  avatar muzamil hussain avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.