-3

I have installed Git on my personal laptop. I want the project to be available on github, so that i can work remotely. Can i do it?

https://github.com/digantopaul/documents

Diganto Paul
  • 61
  • 1
  • 4

1 Answers1

0

Yes you can.

How to Work with Code

The code examples presented in this example are available from GitHub at https:// github.com/miguelgrinberg/flasky.

The commit history in this repository was carefully created to match the order in which concepts are presented. The recommended way to work with the code is to check out the commits starting from the oldest, then move forward through the commit list as you make progress. You can also download each commit as a ZIP or TAR file.

If you decide to use Git to work with the source code, then you need to install the Git client, (which you already did so skip this) which you can download from http://git-scm.com. The following command downloads this example code using Git:

$ git clone https://github.com/miguelgrinberg/flasky.git

The git clone command installs the source code from GitHub into a flasky folder that is created in the current directory. This folder does not contain just source code; a copy of the Git repository with the entire history of changes made to the application is also included. In the first chapter you will be asked to check out the initial release of the application, and then, at the proper places you will be instructed to move forward in the history. The Git command that lets you move through the change history is git checkout. Here is an example:

$ git checkout 1a

The 1a referenced in the command is a tag, a named point in the history of the project. This repository is tagged according to the chapters of the book, so the 1a tag used in the example sets the application files to the initial version used in Chapter 1. Most chapters have more than one tag associated with them, so, for example, tags 5a, 5b, and so on are incremental versions presented in Chapter 5. In addition to checking out the source files for a version of the application, you may need to perform some setup. For example, in some cases you will need to install addi‐ tional Python packages or apply updates to the database. You will be told when these are necessary. You will normally not modify the source files of the application, but if you do, then Git will not let you check out a different revision, as that would cause your local changes to be lost. Before you can check out a different revision, you will need to revert the files to their original state. The easiest way to do this is with the git reset command:

$ git reset --hard

This command will destroy your local changes, so you should save anything you don’t want to lose before you use this command. From time to time, you may want to refresh your local repository from the one on GitHub, where bug fixes and improvements may have been applied. The commands that achieve this are:

$ git fetch --all
$ git fetch --tags
$ git reset --hard origin/master

The git fetch commands are used to update the commit history and the tags in your local repository from the remote one on GitHub, but none of this affects the actual source files, which are updated with the git reset command that follows. Once again, be aware that any time git reset is used you will lose any local changes you have made. Another useful operation is to view all the differences between two versions of the application. This can be very useful to understand a change in detail. From the command

line, the git diff command can do this. For example, to see the difference between revisions 2a and 2b, use:

$ git diff 2a 2b

The differences are shown as a patch, which is not a very intuitive format to review changes if you are not used to working with patch files. You may find that the graphical comparisons shown by GitHub are much easier to read. For example, the differences between revisions 2a and 2b can be viewed on GitHub at https://github.com/miguelgrin berg/flasky/compare/2a...2b

Mr-Programs
  • 767
  • 4
  • 20