Git
Set User profile
git config --global user.email "[email protected]"
git config --global user.name "Serge Kurian"
Repository Management
Init with main branch
Create New Repository
echo "# delete" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:jdedev/delete.git
git push -u origin main
Branches
Misc
Commit
git add . ; git commit -m "update" ; git push ; git status
Restore Unstaged Changes
Submodules
Add submodule
Init submodule/Pull Submodules (after clone)
git submodule update --init
Update submodules (get latest changes)
git submodule update --recursive --remote
Clone and check-out submodules
Missing submodules are cloned.
All submodules are checked out correctly.
The latest changes are pulled from each submodule’s remote repository.
git submodule update --init --recursive;
git submodule foreach --recursive git reset --hard origin/main;