Understanding Git Workflow and Version Control

𝑾𝒉𝒂𝒕 𝑰 𝑳𝒆𝒂𝒓𝒏𝒆𝒅 𝑨𝒃𝒐𝒖𝒕 𝑮𝒊𝒕 𝑾𝒐𝒓𝒌𝒇𝒍𝒐𝒘 𝑻𝒐𝒅𝒂𝒚 We often upload our projects to 𝐆𝐢𝐭𝐇𝐮𝐛, but many of us do not really know how the code actually gets uploaded. So today, let’s understand the Git workflow. The working directory is the part where we write or edit our code. All changes happen here before Git starts tracking them. After writing or modifying the code, we add the changed files to the staging area. The staging area is where we keep only the selected changed files that we want to commit. - If we want to add multiple changed files to the staging area, we use the command 𝐠𝐢𝐭 𝐚𝐝𝐝 . - If we want to add only a specific file, we use 𝐠𝐢𝐭 𝐚𝐝𝐝 𝐢𝐧𝐝𝐞𝐱.𝐟𝐢𝐥𝐞 (here we provide the name of the file we want to add). After that, the code is saved in the local repository. The local repository is created when we run the command 𝐠𝐢𝐭 𝐢𝐧𝐢𝐭. This command creates a hidden .git folder inside the project, which stores all the committed changes. To move the code from the staging area to the local repository, we use the git commit command along with a commit message (for example: 𝐠𝐢𝐭 𝐜𝐨𝐦𝐦𝐢𝐭 -𝐦 "𝐅𝐢𝐫𝐬𝐭 𝐜𝐨𝐦𝐦𝐢𝐭"). Finally, the code is uploaded to the remote repository, which is the GitHub repository. This is done using the 𝐠𝐢𝐭 𝐩𝐮𝐬𝐡 command. After this step, our code becomes available on GitHub. Learned this concept from Farzeen Ali sir’s YouTube channel. Thank you. #Git #GitWorkflow #GitHub #VersionControl #LearningJourney #ComputerScience #CSEStudent

  • No alternative text description for this image

keep growing and keep learning

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories