This slide introduces the concept of Version Control, using Git & Github.
This slide is a part of a the Course "Learn Python, Django & Web Development".
Read More here https://github.com/kabirbaidhya/learn-python-django-web.
Every client has a complete copy of the repository Synchronize the changes in between client & server Every clone is really a full backup of the repository Example: Git, Mercurial, etc.
git is to set up your user name and email. $ git config --global user.name <name> $ git config --global user.email <email> Then you can check your con g with $ git config --list user.name=Kabir Baidhya [email protected] core.editor=vim core.excludesfile=/home/kabir/.gitignore_global
repository you'll need to commit your changes. You rst need to select les you want to commit using this git add command. # Add specific file(s) $ git add <file(s)...> # Add whole path or directory $ git add <path> # Add all of your changes $ git add --all
changes to the history. $ git commit This will ask you to enter a commit message for your commit. In case you don't like to be prompted for the message, you can set directly using the -m option like this $ git commit -m "This was my first commit"
status of the working directory and the staging area. $ git status If you have nothing to be committed or no untracked les then it would just show some message like this $ git status On branch master nothing to commit, working directory clean But if you have some changes to be committed it lists them.
the history of committed changes on the repository. $ git log There are lots of options available for better inspection of history. For instance, $ git log --oneline # Shows each commit on one line $ git log -n <limit> $ git log --author="<pattern>" $ git log <since>..<until>
of a remote server to be able to synhronize your changes with the remote repository. You can do this using the git remote add command. $ git remote add <name> <remote url> You can verify added remotes by doing $ git remote -v It should list the urls to the remote repositories you've added so far.
to your local repository to the remote repositories is pretty simple with git push command. # Push a local branch changes to remote $ git push <remote> <branch> # Push all the changes of local branches to remote $ git push <remote> --all For instance: $ git push origin master
of the current branch from remote and merges it into the local branch. This is same as running the combination of git fetch and then git merge . $ git pull <remote> [branch] Example: $ git pull origin master
working directory to a speci c change (commit), branch, tag or or even different versions of les. You can do all these things with just a simple command git checkout . $ git checkout <commit> # go to that commit $ git checkout <commit> <file> # checkout that file to previous $ git checkout <branch> # go to another branch $ git checkout <tag> # go to a tagged version of the r