Kyle Martinez Basic Git Commands

Created by Kyle Martinez last modified
# tell git who you are
git config --global "Barry Allen"
git config --global

# create a new local repository
git init

# clone to a local repository
git clone

# add files
git add *
git add flash.js

# remove files
git rm *
git rm flash.js

# move or rename files
git mv -f flash.js flash-2.js #rename in current directory
git mv -f flash.js js/flash-2.js # move to a new directory

# commit files
git commit -m "Cisco comes up with the names"

# push files
git push orgin master

# pull files
git pull

# completely rebuild local repo and lose all current changes
git fetch --all
git reset --hard origin/master

# revert back to a previous commit
git reset 56e05fced 
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
git reset --hard

# remove tag
git tag -d <tag_name>
git push origin :refs/tags/<tag_name>

Comments (0)