Coming from an SVN versioning system to GIT has been a long strange trip; at first, SVN commands made more sense, like checkout and update, but then when you think about it, they're backward.
Whereas with Git, I'm noticing it's more like *nix CLI commands to deal with files, commits, etc.
Remove a file
#Note pass -r for recursive to remove folder #Note pass -f to force removal, you can combine these like -rf git rm filename
Rename / Move a file
git mv filename
Add File or Files for Commit
## Add all files git add ./ ## Add just filenames git add filename
Commit with message
git commit -m "Useful message" # Better commit but know your editor it normally opens VIM, NANO, or whatever you setup as EDITOR # in your .bashrc or .zshrc git commit
Pull From Server
# Pulls the currently tracked branch git pull
Change Branch and Pull From Server
#example git checkout -b < new_branch > origin/< new_branch > git checkout -b newbranch origin/newbranch
Push to the server, replace master with branch
git push origin master git push remote branch
- Switch branches
git checkout branchname
- Create a tag
git tag tagname git push origin :refs/tags/tagname
- Push a tag
git push --tags
- Delete a tag
git tag -d tagname git push origin :refs/tags/tagname
- Adding Remote Repo
git remote add **alias** **url** #Example git remote add upstream git://github.com/octocat/Spoon-Knife.git git fetch upstream git merge upstream/develop
There's more, but that'll do for this post.
Highly suggest learning git-flow
Did you find this article valuable?
Support Shawn Crigger by becoming a sponsor. Any amount is appreciated!