Working With Git
- Git init
git init . - git config
- What .gitignore file I should create ??
Working on a branch
this is for new branch
git checkout -b blackhole/removing-featurethis is existing branch
git remotegit fetch origingit branch -agit checkout -b blackhole/removing-featurework work work
code .git add .git commit -a -m "Message about the commit"git push -u origin blackhole/removing-uwgit push --set-upstream origin blackhole/removing-featureClean up local
git checkout maingit pullremote branch delete
git pull --prunedelete local branch
git branch -d blackhole/removing-featuregit branch --allGit commit
git add .git commit -am "Message about the commit"git pushForce git overwrite local file
git fetch --allgit reset --hard origin/masterIf other branch
git reset --hard origin/<branch_name>Maintain current local commits
git checkout mastergit branch new-branch-to-save-current-commitsgit fetch --allgit reset --hard origin/mastergit stashgit stash popClean WARNING: this can’t be undone!
git reset --hard HEADgit clean -f -dgit pullFor dry-run
git clean -n -f -dfind which remote repository it is linked to
git remote -v