My friend wants to learn python, so I had suggested to go through online learning than going through books or videos. Initially I had solved plenty of questions from Hackerrank but later had stopped when I had plenty much on my plate. So in my notice period thought to again cultivate the habit of going through the online learning to increase my knowledge.
1. Learn GitHub (2 hours coursework):
Managing Git Hub Basic Commands:
git commit -m "Complete the message in present tense"
git show HEAD : more recently made commit
git add file1 file2: add files to staging
git checkout HEAD filename: to download original files before the changes
git reset filename: to unstage that file from the commit
1. Learn GitHub (2 hours coursework):
Managing Git Hub Basic Commands:
git commit -m "Complete the message in present tense"
git show HEAD : more recently made commit
git add file1 file2: add files to staging
git checkout HEAD filename: to download original files before the changes
git reset filename: to unstage that file from the commit
git reset SHA: Git enables you to rewind to the part before you made the wrong turn and create a new destiny for the project. This command works by using the first 7 characters of the SHA of a previous commit.
git branch: to check the current branch
git branch <newbranch>: To create the new branch
git checkout <newbranch>: Switch to new branch.All the changes made in the master would be copied to the new branch. Use "git logs" to view the changes of the master in "new branch".
git merge branch_name: Include all the changes made to the new_branch on the master branch. We can accomplish this by merging the branch into the master
i) git checkout master: To switch to the master branch
ii) git merger <newbrch>: All the files from new_branch would be merged on master branch
git branch -d <new_branch>: delete the branch
git branch <newbranch>: To create the new branch
git checkout <newbranch>: Switch to new branch.All the changes made in the master would be copied to the new branch. Use "git logs" to view the changes of the master in "new branch".
git merge branch_name: Include all the changes made to the new_branch on the master branch. We can accomplish this by merging the branch into the master
i) git checkout master: To switch to the master branch
ii) git merger <newbrch>: All the files from new_branch would be merged on master branch
git branch -d <new_branch>: delete the branch
Imagine that you're a science teacher, developing some quizzes with Sally, another teacher in the school. You are using Git to manage the project.
In order to collaborate, you and Sally need:
- A complete replica of the project on your own computers
- A way to keep track of and review each other's work
- Access to a definitive project version
You can accomplish all of this by using remotes. A remote is a shared Git repository that allows multiple collaborators to work on the same Git project from different locations. Collaborators work on the project independently, and merge changes together when they are ready to do so.
Sally has created the remote repository, science-quizzes in the directory curriculum, which teachers on the school's shared network have access to. In order to get your own replica of science-quizzes, you'll need to clone it with:
git clone remote_location clone_name
You can see a list of a Git project's remotes with the command: git remote -v
After you cloned science-quizzes, you had to run off to teach a class. Now that you're back at your computer, there's a problem: what if, while you were teaching, Sally changed the science-quizzes Git project in some way. If so, your clone will no longer be up-to-date.
An easy way to see if changes have been made to the remote and bring the changes down to your local copy is with:
git fetch
Even though Sally's new commits have been fetched to your local copy of the Git project, those commits are on the
origin/master
branch. Your local master
branch has not been updated yet, so you can't view or make changes to any of the work she has added.
In Lesson III, Git Branching we learned how to merge braches. Now we'll use the
git merge
command to integrate origin/master
into your local master
branch. The command:git merge origin master
git pull : does a git fetch followed by a git merge.
git push origin <branch_name>: To push the work to the remote server