Git
Git is the most popular version control system (Distributed VCS).
1.Installing Git
$ sudo apt-get install git
2. Starting our Git repository
Initializing the git repository is something we only need to do once per project (and you won't have to re-enter the username and email again ever).
Open up your console and run these commands, in the project directory:
$ git init
Initialized empty Git repository in ~/djangogirls/.git/
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ git config --list (Details of the Git Account )
Git will track changes to all the files and folders in this directory, but there are some files we want it to ignore. We do this by creating a file called .gitignore in the base directory. Open up your editor and create a new file with the following contents:
*.pyc
__pycache__
myvenv
db.sqlite3
/static
.DS_Store
And save it as .gitignore in the project folder.
$ git status
$ git add -A . (be careful about the dot in the end)
$ git commit -m "My Django Girls app, first commit"
Pushing our code to GitHub
Go to GitHub.com and sign up for a new, free user account.
Then, create a new repository, giving it the name "my-first-blog".
Leave the "initialise with a README" tickbox un-checked, leave the .gitignore option blank (we've done that manually) and leave the License as None.
On the next screen, you'll be shown your repo's clone URL. Choose the "HTTPS" version, copy it, and we'll paste it into the terminal shortly:Now we need to hook up the Git repository on your computer to the one up on GitHub.
$ git remote add origin https://github.com/<your-github-username>/my-first-blog.git
$ git push -u origin master
Enter your GitHub username and password and you should see something like this:
Username for 'https://github.com':
********
Password for 'https://hjwp@github.com':
********
Your code is now on GitHub. Go and check it out!
Pulling Request from Github
git clone https://github.com/ShivamMahajan/my_first_flask_project.git
Create a Branch
Branching is the way to work on different versions of a repository at one time.
By default your repository has one branch named master which is considered to be the definitive branch. We use branches to experiment and make edits before committing them to master.
When you create a branch off the master branch, you’re making a copy, or snapshot, of master as it was at that point in time. If someone else made changes to the master branch while you were working on your branch, you could pull in those updates.
To create a new branch
Go to your new repository hello-world.
Click the drop down at the top of the file list that says branch: master.
Type a branch name, readme-edits, into the new branch text box.
Select the blue Create branch box or hit “Enter” on your keyboard.
Make and commit changes
Started and managed a new branch
Changed a file and committed those changes to GitHub
Opened and merged a Pull Request
0 comments:
Post a Comment