- git init #Initialise locat repositiry
- git add <file> #Add files to index
- git status #Check status of working tree
- git commit #Commit changes in index
- git push #Push to remote repository
- git pull #Pull latest from remote repository
- git clone #Clone repository into a new directory
##-----------------------------------------------------------------------------
1. Configure
- git config --global user.name 'Ian Horne'
- git config --global user.email 'ian@ihorne.com'
##-----------------------------------------------------------------------------
2. File to staging
- git add <file name> #Add file
- git rm <file name> #Remove file
- git add *.py #Add all .py files to staging area
- git add . #Add all files in directory to staging area
##-----------------------------------------------------------------------------
3. Commit staging area to your local repository
- git commit -m "your comments"
##-----------------------------------------------------------------------------
4. Ignore file
- create .git ignore file <touch .gitignore>
- enter file or folder into .gitignore file to exclude it from the repository
-Add file - <file.ext>
-Add directory - </dirname>
-Add all text files - <*.txt>
##-----------------------------------------------------------------------------
5. Branches - https://www.atlassian.com/git/tutorials/using-branches
- git branch <branch_name> #Create branch
- git checkout <branch_name> #move to branch
- git add <filename> #add file change to branches
- git commit -m "comments" #commit file and add comments
- git checkout <master> #move to main branch
- git merge <branch name> #merge branch into current branch location
- git push #push branch to hub
- git branch -d <branch> #delete branch
##-----------------------------------------------------------------------------
6. Remove repositories
- Create new repository
- git remote #list all remote repositories
- git remote add origin https://github.com/Ianhorne73/WageReport.git
- git push -u origin master
##-----------------------------------------------------------------------------
Future workflow
- change file
- git add .
- git push
##-----------------------------------------------------------------------------
Clone repository
- git clone <get link from GIT hub> #Clone repository from GIT Hub
- git pull #Get latest updates
Comments