First Branch and Commit | Bondar Academy
Course: Git and GitHub Fundamentals
Module: Working with Git and GitHub
Instructor: Artem Bondar
Lesson Summary
In this lesson, we cover the initial Git configuration , creating a first branch, and making the first commit using both the command line and Visual Studio Code interface. Initial Configuration Protect the master branch to prevent direct pushes. Go to Settings in your repository, then Branches . Add a branch protection rule : Set the branch name pattern to master . Check Require a pull request before merging . Uncheck additional approvers and check Do not allow bypass . Configuring Git Set your global user email and name using the following commands: git config --global user.email "[email protected]" git config --global user.name "Your Name" Validate the configuration with: git config --global user.email git config --global user.name Creating a Branch Create a new branch with git branch first_code . Switch to the new branch using git checkout first_code . Making Changes Create a new file (e.g., test_file.txt ) and save it. Stage the file with git add . . Commit your changes using git commit -m "Initial commit message" . Tracking Changes Use git status to check the status of files. Use git diff to see unstaged changes. Commit additional changes similarly. Reviewing Commits View all commits with: git log This displays commit history along with unique identifiers for each commit. In the next lesson, we will learn how to push the branch to the remote repository.