Git/Github

Git/Github

"Demystifying Git and GitHub: A Comprehensive Guide to Version Control and Collaborative Development"

This article will provide a thorough understanding of both Git and GitHub, making it accessible to both beginners and those looking to deepen their knowledge.

Save,Reshare GitHub

Basic Steps:-

  • Install: git :: on your system
  • Set your username and email?


  1. $ git config --global user.name "abc"
  2. $ git config --global user.email "[email protected]"


Check your setup?

  1. $ git config –list


Basic Commands to check status/log

  • $ git status
  • $ git log

Process-1


Set Gihub account?


Create your Repository: Test1


Copy Test1 in your local folder(directories) your?


$ git clone …..https_link……

$ ls -a


?You will find .git file


Add new file or update existing file any file


Go for Staging Area

$ git add .


Go for commit (local git repository commit)

$ git commit -m “first commit”


Push to Github

$ git push origin main

?

Process-2


Create local repository first and create one file


Initialize git?

$ git init


$ ls -a

?You will find .git file


Add new file or update existing file any file


Go for Staging Area

$ git add .


Go for commit (local git repository commit)

$ git commit -m “first commit”


Link to your github repository

$ git remote add origin https://github.com/OWNER/REPOSITORY.git


Check your setup

$ git remote -v


Push to Github

$ git push origin main



Branching and Merging

  • $ git branch

Create New Branch

  • $ git branch -b newbranchname

Delete any branch

  • $ git branch -d branchname

Switch to any branch

  • $ git checkout branchname

Rest all processes are same for git add/commit/push


We can merge two branches with/without conflict using pull request

  • $ git pull origin <branch name>


要查看或添加评论,请登录

社区洞察

其他会员也浏览了