pwd - To get path of working directory
ls - To list all files and directories of working directory
mkdir DirectoryName - To make directory of name DirectoryName
rmdir DirectoryName - To remove directory of name DirectoryName
cd DirectoryName - To open the directory of name DirectoryName
cat FIleName - To make file of name FileName
rm FIleName - To remove file of name FileName\
rm -rf .git - To remove .git file (undo git init)
echo -e "Text" >> FileName - To add Text to the end of the file of name FileName
echo -e "Text" > FileName - To clear and add (overwrite) Text to the file of name FileName
more FileName - To display content of the file of name FileName
more ./-file00 - To display content of the file of name -file00 (Example for file with name starting with -)
more ./* - To display content of all files on the directory (Use * instead of name to run any command for all the files/directories)
cp -r ExistingFile/DirectoryName CreatedFile/DirectoryName - To create a copy of ExistingFile/DirectoryName as CreatedFile/DirectoryName in the working directory
file FileName - To display file type
find - To display files that satisfy certain conditions (like size, type, permissions, have certain text in them)
git init - Initialise git (start saving versions)
git config --global user.name "username" - To set username
git config --global user.email "email" - To set email
git config --list - To list all configurations
git status - Shows changes that are not committed
git add FileName - Include FileName's changes to be updated in the next commit
git add DirectoryName - Include DirectoryName's changes to be updated in the next commit
git add . - Include all files/directories' changes to be updated in the next commit
git commit -m "Message" - Commits changes in the files added
git log - Lists history of all commits made
git checkout HEAD~1 - Go to the previous version of the directory
git checkout master - Go to the latest version of the directory
git branch BranchName - Create a branch of name BranchName
git checkout BranchName - Go to the branch of name BranchName
-
git checkout master
-
git merge BranchName - To merge BranchName to selected branch/master
Then add and commit
Go to the file and correct the conflict manually, then add and commit
git remote add RemoteName RepoURL - Add remote to local repository (RemoteName can be anything but is generally origin or upstream)
git remote remove RemoteName - Remove remote
git push RemoteName BranchName - Push commits of BranchName to remote repository
git push RemoteName - Push commits of all branches to remote repository
git fetch RemoteName BranchName - Downloads changes to local repository
git merge RemoteName/BranchName - To merge BranchName of remote to local repository (Similar to git merge BranchName)
git pull RemoteName BranchName - Merge changes to local repository (It is like combination of previous two, fetch and merge commands)
git clone RepoURL - Clone the repository from remote to local repository
.gitignore - Add file names in this files to make then non trackable for git
.sh file - Type commands in .sh file to be able to run those commands in the terminal