-
Notifications
You must be signed in to change notification settings - Fork 38
Git and Github
-
Git
Git a version control system similar to SVN. It is open source software developed by Linus Benedict Torvalds. It is simple and convenient to use. It has been best too of programmers as it allows us to go back to the functioning code if we mess things up last minute. It will also track who made changes and when. It is a great tool for working in huge group.
Once you install git on your computer, you can look at the following commands. If git is not set up in your computer, you can Google it or reach out to one of our members.
Basic Git Commands:
-
git clone:
git clone https://github.com/UPenn-RoboCup/UPennalizers.git
This copies files in the above repo to your computer. You can only clone repository that you have access to.
-
git add:
git add file1.lua file2.sh file.mat
Add untracked files to tracking list Once new files are added, git starts keeping its account
`git add .`
It adds new files also removes files from server that you locally. Be careful!
-
git commit:
git commit file1 file2 file3 -m “Message”
It commits changes that you made in files1,2,4 (if they are being tracked)
`git commit -a -m “Message”`
It commits changes of all the files that are tracked
-
git pull:
git pull
Pull all the recent changes from github/ other git server
-
git push:
git push
Push your changes to cloud
-
git status:
git status
Shows files that you committed but not pushed yet Shows files that you changed but not committed
-
git checkout:
git checkout <another branch name>
Change current branch to another branch
-
git diff
git diff
Difference in local files and server files(of current branch)
`git diff branch1 branch2`
Difference in codes of branch1 and branch2
-
git stash
git stash
Remove all the changes you made but not committed. Useful when you think the changes you made are not committable.
Advance
-
git branch -la
git branch -la
List all branches available.
-
git branch -d
git branch -d
This deletes fully merged branch.
-
git branch -D
git branch -D
List deletes branch even if it's not merged.
-
git clone:
-
Github
Github is a free server with unlimited storage to stores our code. Github is the official server used by most git users. You can store both public and private repository in github. Public repo is free and unlimited while private costs you money. You can also get 5 private repo with
.edu
email. You can set local git server for free if you don't want whole world to see your source code.