Git hub notes and Tutorials link
Source: https://www.youtube.com/watch?v=gwWKnnCMQ5c
Notes from the video tutorial:
1. git diff: This command compares files from your working tree to the files in Staging area.
2. git diff --staged: This command compares files from Staging area to the last commit.
3. git add -A: Add all files to the staging area
4. git commit -m "Test message": Commit changes from staging area
5. git status
6. git log
7. git checkout -f: Change files from your working tree to match the files in the last commit
8. git commit -a -m "Test message": Commit all the changes in your working tree without putting them in staging area. i.e. This skips the step of adding the
files to staging area (not recommended)
9. ls: Lists all the files in the directory
10. git rm --cached FILENAME: removes file from staging area.
11. git rm FILENAME: Deletes file from working directory.
12. Scenario: How to Delete a file from master which you added by mistake?
git rm FILENAME //Removes file from working tree
git commit -a -m "Test message" // This will remove the extra(unwanted) file from master.
13. git status -s: Shows a summarized view of files added/deleted or modified. an "M" with green color notifies that the file is modified and is in staging area.
and one with red color notifies that the file is being modified in both staging and working directory.
14. How to Ignore some files
15. Create new branch: git branch feature1 // creates a branch with name feature1
16. git branch //shows all the branches
17. Switch to a branch: git checkout BRANCH_NAME
eg., git checkout feature1
18. Merge your branch into master
Step 1: switch to Master branch using command: git checkout master
Now, merge your branch into master using command: git merge BRANCH_NAME
eg., git merge feature1
19. If you use git branch BRANCH_NAME to create a new branch, a new branch will be created but you will still be on master.
If you want to switch to the new branch immediately after creation, use: git checkout -b BRANCH_NAME
20. If you want to merge changes from Master branch into your branch, go to that branch and type: git merge master
Comments
Post a Comment