Github instructions.
First create an account in github https://github.com
Use the '+' icon on the top right corner.
For example create a repository named 'my-project'
Add some description to repository description input box.
Choose public repository as repository type.
Tick 'Initialize this repository with a README'
Now you just finished creating your first repository.
On the repository page we can see a green Clone or download button. Click it and you will see the url of your repository.. Copy it.
Open the Terminal (Command Prompt).
I hope you have already installed git. Otherwise install git. After that, do the following:
On the command prompt execute the command:
git clone <the url you copied>
For eg: git clone https://github.com/xxxxxxxxxxx/my-project.git
This will create a folder in the present directory named 'my-project'
You can open it and see the files in it.. It consists of a readme.md file and a hidden .git folder.
Create a file named sample.txt in the my-project folder and add some text in it.
Take the terminal and just change the working directory to 'my-project'. For it execute the following command:
cd my-project
After it run the following command:
git status
It will show the below result
----------------------------------------
First create an account in github https://github.com
Create a repository:
Use the '+' icon on the top right corner.
For example create a repository named 'my-project'
Add some description to repository description input box.
Choose public repository as repository type.
Tick 'Initialize this repository with a README'
Now you just finished creating your first repository.
Clone the Repository to your local machine:
On the repository page we can see a green Clone or download button. Click it and you will see the url of your repository.. Copy it.
Open the Terminal (Command Prompt).
I hope you have already installed git. Otherwise install git. After that, do the following:
On the command prompt execute the command:
git clone <the url you copied>
For eg: git clone https://github.com/xxxxxxxxxxx/my-project.git
This will create a folder in the present directory named 'my-project'
You can open it and see the files in it.. It consists of a readme.md file and a hidden .git folder.
Updating your changes to git repository
Create a file named sample.txt in the my-project folder and add some text in it.
Take the terminal and just change the working directory to 'my-project'. For it execute the following command:
cd my-project
After it run the following command:
git status
It will show the below result
----------------------------------------
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
sample.txt
nothing added to commit but untracked files present (use "git add" to track)
-----------------------------------
Now execute the below command :
git add sample.txt
It is adding the file to git index.
Then the next command:
git commit -m 'first commit'
Then the next command:
git push origin master
Now it will ask for your username and password of git, paste it and now you just finished your first commit to the git repository.
Now check your git repository and you can see the new file 'sample.txt' there..
Just check out the insights->graphs->network You can see a graphical representation of the commits. It will be very helpful when having many branches.
Create Branch
We can create branch in github or in terminal.
For now just create a new branch in github.
For it click on the dropdown 'Branch:master' and type the new branch name in the input box 'first-branch' and hit enter. it will create a branch.
Then open the terminal and type the command
git pull
It will show the new branch there
For working with the new branch run the following command:
git checkout first-branch
It will show the message like 'Switched to a new branch 'first-branch''
Then create another file sample2.txt and add some content to it.
Then take the terminal and run the command:
git status
It will show the new file sample2.txt there and commit it as we done early:
git add sample2.txt
git commit -m 'test'
git push origin first-branch
After committing the sample2.txt check the git repository and insights->graphs->network. We can see the new branch there.
Create Pull Request and Merge it to master:
I hope in the repository now you can see the button 'Compare & Pull Request'. Click on it and the following page click on 'Create Pull Request' and on the following page 'Merge Pull Request'. then 'Confirm Merge'. Now the new branch is merged with the master branch.
Now check the graph and we can see the new branch merged with the master branch.
Take the terminal and run the below command:
git pull
As the current branch 'first-branch' it is uptodate
Now change the branch to master.
For it run the command
git checkout master
Now open the 'My project' folder and we can see it is missing the second file we created in the first branch' So we need to update the branch.. for it again git pull from terminal...
Now I hope you get the basic ideas... check some more tutorials and you will get more ideas..
https://guides.github.com/activities/hello-world/
Git commands I used :
git clone https://github.com/xxxx/sample_repo.git
945 ls
946 cd sample_repo/
947 ls
948 git status
949 git add sample.txt
950 git status
951 git commit -m "sample file added"
952 git status
953 git push
954 git status
955 git pull
956 git checkout add-name
957 git status
958 cd ..
959 git status
960 cd sample_repo/
961 git branches
962 git --help
963 git branch
964 git checkout master
965 git branch
966 git checkout add-name
967 git status
968 git add sample.txt
969 git status
970 git commit -m 'added name'
971 git status
972 git push
973 git pull
974 git checkout master
975 git status
976 git pull
977 git checkout master
978 git status
979 git add sample.txt
980 git commit -m 'house name added'
981 git push
982 git checkout add-name
983 git pull
984 git checkout master
985 git pull
986 git checkout add-name
987 git status
988 git remote -v
989 git status
990 git checkout -b family
991 git status
992 git add sample.txt
993 git commit -m 'added count of family members'
994 git push
995 git push --set-upstream origin family
996 git checkout master
997 git checkout -b father
998 git status
999 git add sample.txt
1000 git commit -m 'father name added'
1001 git push origin father
1002 git checkout family
1003 git status
1004 git pull
1005 git checkout master
1006 git pull
1007 git checkout family
1008 git branch
1009 git merge master
1010 git status
1011 git add sample.txt
1012 git -m 'merged manually'
1013 git commit -m 'merged manually'
1014 git status
1015 git push
1016 git merge father
1017 git checkout family
1018 git reset --hard 9742e
1019 git status
1020 git add
1021 git add *
1022 git status
1023 git commit -m 'added hello'
1024 git push
1025 git pull
1026 git status
1027 git checkout father
1028 git pull
1029 git branch
1030 git branch --set-upstream-to=origin/father
1031 git pull
1032 git diff master father
1033 git merge master
1034 git branch
1035 git checkout master
1036 git pull
1037 git checkout father
1038 git merge master
1039 git status
1040 git git add sample.txt
1041 git add sample.txt
1042 git commit -m 'merged'
1043 git push origin father
1044 git chekout master
1045 git checkout master
1046 git status
1047 git pull
1048 git merge father
1049 git status
1050 git push origin master
1051 git status
1052 cd ..
1053 cd gittest/
1054 git init
1055 git status
1056 git add test.txt
1057 git commit -m 'test added'
1058 git push origin master
1059 git remote add origin https://github.com/ccccccc/saa.git
1060 git push origin master
Git commands I used :
git clone https://github.com/xxxx/sample_repo.git
945 ls
946 cd sample_repo/
947 ls
948 git status
949 git add sample.txt
950 git status
951 git commit -m "sample file added"
952 git status
953 git push
954 git status
955 git pull
956 git checkout add-name
957 git status
958 cd ..
959 git status
960 cd sample_repo/
961 git branches
962 git --help
963 git branch
964 git checkout master
965 git branch
966 git checkout add-name
967 git status
968 git add sample.txt
969 git status
970 git commit -m 'added name'
971 git status
972 git push
973 git pull
974 git checkout master
975 git status
976 git pull
977 git checkout master
978 git status
979 git add sample.txt
980 git commit -m 'house name added'
981 git push
982 git checkout add-name
983 git pull
984 git checkout master
985 git pull
986 git checkout add-name
987 git status
988 git remote -v
989 git status
990 git checkout -b family
991 git status
992 git add sample.txt
993 git commit -m 'added count of family members'
994 git push
995 git push --set-upstream origin family
996 git checkout master
997 git checkout -b father
998 git status
999 git add sample.txt
1000 git commit -m 'father name added'
1001 git push origin father
1002 git checkout family
1003 git status
1004 git pull
1005 git checkout master
1006 git pull
1007 git checkout family
1008 git branch
1009 git merge master
1010 git status
1011 git add sample.txt
1012 git -m 'merged manually'
1013 git commit -m 'merged manually'
1014 git status
1015 git push
1016 git merge father
1017 git checkout family
1018 git reset --hard 9742e
1019 git status
1020 git add
1021 git add *
1022 git status
1023 git commit -m 'added hello'
1024 git push
1025 git pull
1026 git status
1027 git checkout father
1028 git pull
1029 git branch
1030 git branch --set-upstream-to=origin/father
1031 git pull
1032 git diff master father
1033 git merge master
1034 git branch
1035 git checkout master
1036 git pull
1037 git checkout father
1038 git merge master
1039 git status
1040 git git add sample.txt
1041 git add sample.txt
1042 git commit -m 'merged'
1043 git push origin father
1044 git chekout master
1045 git checkout master
1046 git status
1047 git pull
1048 git merge father
1049 git status
1050 git push origin master
1051 git status
1052 cd ..
1053 cd gittest/
1054 git init
1055 git status
1056 git add test.txt
1057 git commit -m 'test added'
1058 git push origin master
1059 git remote add origin https://github.com/ccccccc/saa.git
1060 git push origin master