Many of the posts I wrote for this website use Linux and Git commands… and they assume you know them. I’m usually the first one to complain about that, but I couldn’t spend hundred of hours documenting every single step in every post. With this post, I’m hoping to give you a few references that will help you. As with everything in life, when in doubt, Google it. Most of what I know about Linux comes from StackOverflow answers anyway!
“Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.” –https://git-scm.com/
Online learning tool: https://try.github.io/levels/1/challenges/1
Git – the simple guide: http://rogerdudler.github.io/git-guide/
Full documentation: https://www.atlassian.com/git/tutorials/
In my tutorials I write down full GitHub URLs, such as https://github.com/JFDuval/FlexSEA/tree/experimental/execute-gui-1, but keep in mind that it’s an active project; these paths might change. In that example, I’m linking to the “experimental” branch. The only other branch, at this point, is “master”. Always be careful when using something from Experimental, as there is no warranty that the code will work. When I get a stable version, I release it using a tag. One example is https://github.com/JFDuval/FlexSEA/tree/v0.1, the last stable commit for FlexSEA-Execute 0.1 (hardware v0.1).
Commands you’ll have to use:
- clone: use that to download the files from Github to your local computer.
- When you see -b, it’s to specify a branch.
- pull: get files from server. This is the equivalent of your SVN Update
- status: lists all the changes in your repo
- add: add new files. This is also how you stage modified files before a commit. add -u adds all the previously commited files.
- commit: typically, you’ll see git commit -m “your commit log message”. It creates a local commit, but it doesn’t modify the server version
- push: pushes your last commit(s) to the server
- reset: did you add files you do not want in your commit? reset will unstage everything.
The workflow should be commit – pull – merge (if necessary) – push. If VIM opens during a merge, refer to this Windows specific reply about how to use it. Other VIM documentation here.
For some people the files and/or directory that was just cloned can be Read Only in the user space. In that case, open a terminal and do sudo nautilus . You are now root in GUI. Go to your folder, right click and change the user permissions to Read & Write. This should solve issued with your IDE saying that it can’t write to files.
Short list of useful commands:
- cd – change current directory
- ls – list directory contents
- chmod – change file permissions
- cp – copy files
- mv – move files
- rm – remove files
- mkdir – make directory
- rmdir – remove directory
- dmesg – read kernel messages. dmesg -T will list them with a timestamp. More info at http://www.linfo.org/dmesg.html