-
Notifications
You must be signed in to change notification settings - Fork 0
Git
(download and install git)[https://git-scm.com/downloads]
In terminal set the the globals
git config --global user.name "fistralpro"
git config --global user.email "fistralpro@example.com"
git config --global core.autocrlf input
we use input as autocrlf as we don't care about windows crlf - we work in wsl2 and linux -> any windows tools will need to respect that
In terminal
git init my-project-name
get the code (assume default branch is main)
git clone git@github.com:repo/project.git
cd project
or, update current code
cd leetcode-solutions
git checkout main
git pull
create a feature branch and push it back for visibility (example branch feature/description)
git branch feature/description
git push origin feature/description
do some code and commit your changes locally (we'll add all new files with .)
git add .
git commit -m "my description of work done"
push your changes to the remote
git push origin feature/description
On successful testing they will be merged to main and then main tagged. The branch will then be deleted.
It is recommended you then pull down that change and delete your local branch.
see which branches have been deleted
git fetch -p
now lets delete our feature/description branch that is still local
git branch -d feature/description
Show branches (q to quit)
//remote
git branch -r
//local (no actual need for -l)
git branch
//all
git branch -a
// details (use any flags - here we use remote)
git show-branch -r
Switch to branch
git pull
git checkout -b {local name} origin/{remote name}
git checkout -b chapter6begin origin/chapter6begin