0% found this document useful (0 votes)
60 views3 pages

Gitcommands

Git is a version control system that allows developers to work on code for different features or functionalities in separate branches. This helps developers work on software in an uncluttered way. Commits can be rearranged and squashed together, and commits from a branch can be selectively added to the master branch using commands like cherry-pick and rebase. The .gitignore file is used to exclude files like compiled class files from being tracked in the local repository. Remote repositories hosted on sites like GitHub can be linked to the local repository using commands like git remote and git push.

Uploaded by

javeeed0401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

Gitcommands

Git is a version control system that allows developers to work on code for different features or functionalities in separate branches. This helps developers work on software in an uncluttered way. Commits can be rearranged and squashed together, and commits from a branch can be selectively added to the master branch using commands like cherry-pick and rebase. The .gitignore file is used to exclude files like compiled class files from being tracked in the local repository. Remote repositories hosted on sites like GitHub can be linked to the local repository using commands like git remote and git push.

Uploaded by

javeeed0401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

working directory: devolpers write source code

git init ---- convert to working directory


git config --global user.name "javeed"
git config --global user.email "[email protected]"

git config --global --list


git config --edit --global
working direcory ------> staging area ------>LR
untracked files
staged files
commited files
untracked --------to staging area git add <filename>
git add .
git status check verify
staging area to local repo
git commit -m "a"
git status
6.java
7.java
8.java
git add .
git commit -m "b"
git log ----- show list of commands
branching
this feature is provided in git,so that devolopers can create code related to
different functionalatiies on seperate branches

latest commit known as a head commit


this devolper to devolop softwate unclutter way
devolper
later this code is merged with master
homepage f1 f2 f3
services f4 f5
contact page f6 f7
create 2 files and commit in master branch
commit
git log --oneline list of commits
git branch test
git checkout test
create 3 files
commit 3 files
git log --oneline
git checkout master
git branch
create f3 file
commit f3
git log --oneline
git merge test from master branch
git merge test
.git ignore file
create folder and create
5 java files
1.java
2.java
3.java
4.java 5.java
then when java file compiles .class file create
1.class
2.class
3.class
4.class
5.class

as per git local repo should have only source code not .class file
create vi .gitignore
and add *.class in insertmode
:wq
git rebase
first create f1 f2 commit in master
then checkout master
then f3 f4 f5 commit
then checkout master
then create f6 commit
then checkout test
this is called as fastforward merge.
this commits from the child branch are added to the top of master branch
this is helpful when we we want code from a branch to be reflected as the latest
working version on master
rearrange the commit order
squash
-------------------------
git rebase -i HEAD~4
remove the pick word and replace it with squash
---------------------------------------
how to selectively pickup and commit'from child branch(cherry-pick)

git cherry-pick a7df456 b7gdhjy commit id from child branch

git amend command


amend
create f1 f2 f3 commit
edit f1 using vi editor
again u and tracked file
git add .
git commit --amend -m "a"
how to go previos version version of code
git log --oneline
handling file conflicts
roll back
first create 5 files
coomit
then create 5 files
commit
client want rool back doesnt want last files
then
type
git log --online
copy coommit id
git reset--hard 0707404
remote repository
git remote add origin https://github.com/teluguhackerforfree/javeed123.git
git push -u origin master

You might also like