Git and GitHub Fundamentals for Developers

Today I've watched a couple of videos on youtube , the content related to git and git hub, these are the couple of things I have understood . Git and GitHub Fundamentals Git is a distributed version control system that tracks changes in project files, maintaining a detailed history of who made which changes and when   . GitHub is a popular online platform that hosts Git repositories, enabling developers worldwide to share, collaborate on, and contribute to projects, especially open-source ones. Repositories: Local vs. Remote A repository is essentially a project folder where Git tracks all changes, maintaining a complete history of file creations, modifications, and deletions. A local repository resides on your personal machine, while a remote repository is hosted online, typically on platforms like GitHub. Basic Git Workflow The fundamental Git workflow involves tracking changes, staging them, and then committing them to the project's history. git status: This command shows the current state of your working directory, listing files that have been created, modified, or deleted but are not yet saved in the project's history   . git add <file> or git add .: This command stages changes, preparing them to be included in the next commit. It moves files from an "untracked" or "modified" state to the "staged" area   . git commit -m "message": This command saves all staged changes to the repository's history, along with a descriptive message explaining the changes made  . After a commit, git status should show "nothing to commit". Viewing and Undoing Changes git log: Displays the project's commit history, showing each commit's unique ID, author, date, and message  . git restore <file>: Discards uncommitted changes in your working directory for a specific file, reverting it to its last committed state or unstaging it. git reset <commit_hash>: Moves the HEAD pointer to a previous commit, effectively undoing subsequent commits and removing them from the project's history  git stash: Temporarily saves uncommitted changes (both staged and unstaged) to a "stash" pile, allowing you to switch contexts or branches without committing incomplete work. These changes can be reapplied later. #DevOps #Git #GitHub #VersionControl #CI_CD #RemoteJobs #CloudComputing #TechCareers #OpenSource

To view or add a comment, sign in

Explore content categories