diff --git a/git_test4.txt b/git_test4.txt index 442046a..8fed8cf 100644 --- a/git_test4.txt +++ b/git_test4.txt @@ -1,41 +1,17 @@ -Create branch +After merging if we again go to our branch and make changes in file. Then we have commit changes via +$git commit -a -m "Content added to file 3" #here -a ensure we don’t need to add the files again. We could only do this with already added file to index. -$git branch firstbranch +You can always check the file content by +$cat filename.txt -To move to the new branch -$git checkout firstbranch +Rebasing +Just do the indexing of branch changes in a linear way. -Now you are in the second branch +Lets say we added few more files in branch1 +After adding and commit +When we come back to master branch again just follow the below git command +$git rebase branch1 - - Add a new file on the folder - - Index with firstbranch by $git add newfile.txt - - Commit $git commit -m "making changes in second branch" - -Check files on second branch -$ls - -Go back to master branch -$git checkout master - -Then check -$ls -You will see 1 file missing on the list. - -############################################################# -*** while commit if we don’t use -m then another prompt will come then - - Click "I" button on key pad - - Write your comment - - Click on "Esc" button on key pad - - Write ":wq" and hit "Enter" -Without comment you cant commit -############################################################# - -Merge: - -Before merging make sure, you are in master node. -$git merge branch1 -Now check -$ls -You will see all files available with master branch \ No newline at end of file +Then running the ls command we will see all files on the master branch. \ No newline at end of file diff --git a/git_test5.txt b/git_test5.txt index 442046a..6720de9 100644 --- a/git_test5.txt +++ b/git_test5.txt @@ -1,41 +1,26 @@ -Create branch +Git Push -$git branch firstbranch +Now its time to give back all my works to the remote repository (GITHUB) -To move to the new branch -$git checkout firstbranch +Step 1: generate ssh key +Ssh-keygen +Step 2. A .pub file will be generated +Step3: $cat .pub file address will show the ssh key +To add that key on your github account: + 1. Go to your github account + 2. Click on settings then click on "SSH and GPG keys" + 3. Paste the generated key on that give a title and save -Now you are in the second branch +To authenticate the key that you just pasted (see its been gray marked) +Go to git command line +$ssh -T git@github.com - - Add a new file on the folder - - Index with firstbranch by $git add newfile.txt - - Commit $git commit -m "making changes in second branch" +Now its time to push +Before pushing it is suggested that you will push your branch file so that other partners +Could identify you works. -Check files on second branch -$ls +$git checkout branch1 -Go back to master branch -$git checkout master - -Then check -$ls -You will see 1 file missing on the list. - -############################################################# -*** while commit if we don’t use -m then another prompt will come then - - Click "I" button on key pad - - Write your comment - - Click on "Esc" button on key pad - - Write ":wq" and hit "Enter" -Without comment you cant commit -############################################################# - -Merge: - -Before merging make sure, you are in master node. -$git merge branch1 -Now check -$ls -You will see all files available with master branch \ No newline at end of file +$git push origin branch1