GitClone from github (and submodules) git clone --recursive https://github.com/user/repo_name To check out a specific branch to a local folder, use git clone --recursive https://github.com/user/repo_name.git --branch branch_name repo_name To update current local copy (local Git repo), use pull command git pull origin master Stage a file - i.e. mark changed files (newly created/modified/deleted) to be committed git add newfile.py folder_name/anotherfile.py Commit change(s) to local repository (the quoted part after -m is commit message) git commit -m "Lorem ipsum - I changed these files for good" Push changes to the branch master on the remote repository (e.g. Github) origin git push origin master to unstage uncommitted changes, use
git reset path/to/filename.py Add a submodule into a repository git submodule add https://github.com/user/foo.git
git submodule init
git submodule update
Remove a submodule git submodule deinit -f -- modules/submodule rm -rf .git/modules/a/submodule git rm -f a/submodule Undo modification git checkout -- [filename]
Update submodule to latest version git fetch && git checkout master && git merge origin/master
Source: https://help.github.com/articles/generating-ssh-keys/ ls -al ~/.ssh ssh-keygen -t ed25519 -C "account@email.com" account@gmail.com " # Now copy the content of the public key file ( ~/.ssh/id_rsa.pub ) and create a new SSH key on your Git server https://github.com/settings/ssh # Test connection ssh -T git@github.com # Update the repository remote URL to SSH git remote set-url origin git@github.com: username / REPO .git git remote -v To remember passphrase: eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
Archiving a repository git archive --format zip --output dist/code-trunk.zip master [To be updated] |
Technical notes >