xxxxxxxxxx
# Step 1: Initialize a new Git repository
git init
# Step 2: Create a new file (e.g., filename.txt)
touch filename.txt
# Step 3: Add the file to the staging area
git add filename.txt
# Step 4: Commit the changes with a descriptive message
git commit -m "Added filename.txt"
# Step 5: Create a new branch
git branch new-branch
# Step 6: Switch to the new branch
git checkout new-branch
# Step 7: Make some changes to the file
echo "Hello, Git!" >> filename.txt
# Step 8: Add the changes to the staging area
git add filename.txt
# Step 9: Commit the changes on the new branch
git commit -m "Modified filename.txt on new-branch"
# Step 10: Merge the changes back to the main branch (e.g., master branch)
git checkout master
git merge new-branch
# Step 11: Push the changes to a remote repository (e.g., GitHub)
git push origin master
# Step 12: Pull the latest changes from a remote repository
git pull origin master
Refer to https://learngitbranching.js.org/ for best interactive tutorials.
xxxxxxxxxx
1) Learn basics of staging, commiting
2) Refer this of evreything else https://learngitbranching.js.org/
3) You now know everything you need to and it's time to use your skills in projects
Refer to official docs for the rest.