Wednesday, December 21, 2022

Git setup and commands

Install (Windows)


Install (Ubuntu)

  • Install
apt-get install git


Setup

  • Set up username and email
git config --global user.name "[YOUR NAME]"
git config --global user.email "[YOUR EMAIL ADDRESS]"


Commands

  • Create a local/remote repository

mkdir [Repository name]
cd [Repository name]
git init
New-Item README.md
git add .
git commit -m "Initial commit"
git add remote origin [Repository URL]
git branch -m main
git push --set-upstream origin main

  • Create a new branch locally

git checkout -b dev origin/main
git push --set-upstream origin dev





No comments:

Post a Comment