- check if git is installed
git --version
- Create a local repo
mkdir repoName
- initialize this repo
git init
- create first file say index.html
touch index.html
- check the status
git status
#it shows that git is aware of the file but it is not added to the repo.
- Tracked - files that Git knows about and are added to the repository
- Untracked - files that are in your working directory, but not added to the repository`
Staged files are files that are ready to be committed to the repository you are working on.
git add file_name
Git considers each commit change point or "save point". It is a point in the project you can go back to if you find a bug, or want to make a change.
Pro Tip : Always include a message while commiting file.
git commit -a -m message
-a: If file are not staged, it stages the file and commit -m: It adds a message
git log
git command -help
- See all the available options for the specific commandgit help --all
- See all possible commands
- Add a index.html in your project
- Create gh-pages branch of this repository
- Now go to setting to find : your site is published at github_id.github.io/repo_name
- share that link
first install Git
sudo apt-get install git
configure git
git config --global user.name "your_user_name"
git config --global user.email "email_id"
To check configured user name and user email
git config --global user.name
git config --global user.email
Or Use
git config --global --list
create a local repository
git init my_repository
cd my_repository
gedit readme
gedit mycode.c
now add above two files in index.
git add readme
git add mycode.c
once we have made all the changes, we commit it
git commit -m "some_massage"
Now create a repository on github website
Add origin in your local repository
git remote add origin https:github.com/user_name/my_repository.git
Now push files
git push origin master
If on adding remote origin gives following error
raghvendra@raghs-pc:~/raghsgit$ git remote add origin https://github.com/raghsgit/raghsgit.git
fatal: remote origin already exists.
Resolving
raghvendra@raghs-pc:~/raghsgit$ git remote rm origin
Download a Project On your system to start work locally
-
Download the repository with its content
git clone "<url of project>"
-
now edit the files
-
Now add (prepare) files to upload.
git add *
-
if there is a problem in adding files, one solution is to add file forcefully
git add -f *
-
Commit the changes, with a message.
git commit -m "message"
-
Upload your file to server
git push origin master
To synchronize with local repository
-
Add origin master if not added already
git remote add orign https://githubs.com/raghsgit/raghsgit.git
-
Now Pull the code from server
git pull origin master
-
to remove origin master
git remote rm origin
git remote -v
git remote add upstream
git remote -v
git fetch upstream
git fetch --all
git checkout master
git checkout gh-pages
git merge upstream/master
git fetch create new branch git checkout -b <branch_name> or to switch a branch git checkout <branch_name> to merge in header branch=> git merge origin/<branch_name>
git branch new_branch_name
- create new branchgit branch
- Shows all the branchesgit checkout branch_name
- change the branch- update files in this branch and stage and commit the file
- to merge new branch with master branch:: *1.
git checkout master
-change the branch to master *2.git merge new_branch
- master branch is merged with new_branch
- As the new_branch and master branch are essentially same, so we can delete new_branch
git branch -d new_branch
- open the file in editor and fix the conflict
- commit the changes
- create a repo in the github & copy url of the repo from code section
URL:https://gihub.com/<user_name>/repo_name.git
git remote add origin URL
-specifies that you are adding a remote repository, with the specified URL, as an origin to your local Git repo.git push --set-upstream origin master
git push push our master branch to the origin url, and --set-upstream set master branch as the default remote branch
pull == fetch+merge
This text will be italic
This will also be italic
This text will be bold
This will also be bold
You can combine them
- Item 1
- Item 2
- Item 2a
- Item 2b
- Item 1
- Item 2
- Item 3
- Item 3a
- Item 3b
You may be using Markdown Live Preview.
Markdown is a lightweight markup language with plain-text-formatting syntax, created in 2004 by John Gruber with Aaron Swartz.
Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
Left columns | Right columns |
---|---|
left foo | right foo |
left bar | right bar |
left baz | right baz |
let message = 'Hello world';
alert(message);
This web site is using markedjs/marked
.