Use the following commands:
git init
Go to the settings and on the left-hand side, click on "Collaborators." From there, you can easily add your team members by username or email.
After sending a collaboration request, your team member has to accept this request by clicking on the email or just clicking on the profile picture on GitHub and going to "Your Organization" to join the team.
If you encounter the error: "remote origin already exists," you can
check the existing remotes with git remote -v. To change or
remove the existing link, use git remote remove origin, and
then add the new remote with
git remote add origin <link> followed by
git push -u origin main.
Configure your global Git settings:
git config --global user.name "YourUserName"
git config --global user.email "your@email.com"
git init: Initialize a Git repository.git status: Check the status of your repository.git add .: Stage all changes for commit.git status: Check the status after staging.git commit -m "First Commit": Commit your changes with a
message.
git branch -M main (if you encounter an error): Rename
the default branch to "main."
git remote add origin <YourRepoLink>: Add the remote repository where you want to push and pull changes.
git push -u origin main: Push your changes to the main branch on the remote repository.
git branch: Show all branches.git branch <BranchName>: Create a new branch.
git checkout <BranchName>: Switch to a specific
branch.
git branch --merged: List branches that have been merged
into the current branch.
git merge <BranchName>: Merge changes from the
specified branch into the current branch.
git push origin main: Push changes from the current
branch to the main branch on the remote repository.