Install git (debian)
sudo apt-get install git-coreWorkflow
Generate SSH keys
View: https://help.github.com/articles/generating-ssh-keys
Clone a project (svn checkout equivalent)
git clone https://github.com/username/projectname.git Creates projectname directory and clones the project.
Add a file to the repository
git add filenameShow project status
git statusCommit to the local repository
git commit -a -m "change description"Upload to the central repository
git push git@github.com:username/projectname.gitor (see user configuration),
git pushDiscard all local changes including newly added files
git reset --hardDiscard options
f you want to revert changes made to your working copy, do this:If you want to revert changes made to the index (i.e., that you have added), do this: If you want to revert a change that you have committed, do this: |
Show differences
Update project, download changes (svn update equivalent)
git pullShow diff between master and local repository
git diff
Branches
Make a new branch
git branch ramaShow branches
git branchGo to the branch rama
git checkout ramaMerge with master
git branch master (goto the main branch)
git merge "rama" (merge rama with main) User configuration
User
To automate the pulls:
View the reponame
git config -l
And then
sudo git config remote.origin.url https://{USERNAME}:{PASSWORD}@github.com/{USERNAME}/{REPONAME}.git
Find all *.pyc and remove from the repository
find . -name "*.pyc" -exec git rm -f {} \;Ignore some types of files (global)
git config --global core.excludesfile ~/.gitignore_global Edit ~/.gitignore_global and add patterns like *.pyc