Skip to main content

How update new changes in your Git repository effectively?

Aversion control system enhances the code redundancy over big projects.

I keeps tracks of only the changes and modifications from the previous version and always gives a way to move back and forth across changes in your code.

Git is one of the most popular version control system.

Let us see how to update changes you made, over a remote code base.


git clone

Syntax :      git clone <url associated with your codes repository>

git clone will down load the resources related to you project, to your working directory.


Make the changes you required on theses files and see.


git status

Syntax :      git status

git status will show all the changes which has to be added to staging area and changes which has to be committed.

Files which has changes usually shown in red. Once you made changes, you have to add those changes to staging area(an intermediate state where git will be always tracking changes in that file).


git add

Syntax :      git add <fileName>

git add move your file to staging area.

Always add only files which you really need to commit and then to update on you remote repository.


git stash

Syntax :      git stash

There might be more than one users working on single project. So its is always important to avoid conflicts.

You must compare you changes with latest code available on the common remote repository of your project.

For that, before pushing your changes to the remote repository, you mush pull the latest code from there and should compare with the changes you had made.

If you directly pull the code from the remote repository there is a chance of overwriting of whole changes you made.

If you use git stash before pulling the latest code for comparison, what ever change you had at staging area will be shifted into a isolated space.

After pulling the latest code, there is an option to compare the possible conflicts or to go with final commit and push.


git pull

Syntax :      git pull

Updates the code that you had cloned earlier with latest version of code available at remote repository.

Always use git pull to go with latest code before pushing you changes. Which will reduce a large amount of conflicts, that may occur in future.


git stash apply

Syntax :      git stash apply

It will show the conflict between the latest code you had downloaded and the changes you had made.

Remove the conflicts my looking into wherever the conflict had shown and add the final changes to staging area(git add).


git commit

Syntax :      git commit -m "<CustomMessage>"

git commit saves you changes in your local directory with a message given with -m flag.

Always add only files which you really need to commit and then to update on you remote repository.


git push

Syntax :      git push

Pushes the code to the remote repository.

Git push makes reflects you code at common working remote repository of your project.


It is always a good idea to pull the latest code before every pushing your changes every time.

Comments

Popular posts from this blog

Operating Systems | Scheduling Algorithms : Round Robin

| FCFS | SJF | SRTS | Round Robin | LJF | Priority Scheduling | HRRN | Round RobinFeatures : Most popular algorithm of allPractically implementableImplementable with basic data structures like queueExtremely lesser starvationOptimum efficiency can be set by controlling time quantumThe round robin algorithm will continuously switch between processes if a process in CPU (under execution) exceeds a time limit set by OS called time quantum.Flow Chart :Scheduler allocated process to for execution.CPU starts monitoring the execution time right after from allocation.If the process completes its execution before exceeding time quantum, OS forwards the process to termination state.else, the processes gets preempted once the time quantum limit exceeded and if the process finished at this moment, OS moves the process to termination state, else it moves to ready queue and iterates over the whole process listed above.Example : Consider the following table of processes and calculate complet…

Operating Systems | Concept of Process

Hard disk drive of the system in called primary memory and secondary memory is Random Access Memory(RAM). Either a program written in High Level Language(HLL) or a executable code generated by the sequence of works done by pre-processor, compiler and assembler, resides in secondary memory of the system. To start an execution, operating system allocates some space in the main memory, for the program to be executed and loads the program in the secondary memory to the allocated space. The piece of work which is loaded by the operating system to the main memory in order to execute program is called processEvery program loaded by operating system will create a focus boundary(or process body), a partitioned memory area where all memory requirements for the execution of program is satisfied.Variable which will not change its value through out life time of process is called static variable and variables which are globally accessible in a process known as global variable.Heap area is reserved f…

Operating Systems | Scheduling Algorithms : SJF

| FCFS | SJF | SRTS | Round Robin | LJF | Priority Scheduling | HRRN | Shortest Job First(SJF)SJF algorithm schedules the shortest job(low burst time) available on main memory at the time of context switching in ready state . It can be either preemptive or non-preemptive depending on the nature of scheduler.Since the SJF select the job which is shorted among available jobs on main memory, Non-preemptive SJF algorithm will have larger waiting time if a job with longer burst time get scheduled first. In short SJF is also vulnerable to Convoy EffectTo find shortest process among min-heap would be the best data structure to be usedExample : Consider the following table of processes and calculate completion time, turn around time and waiting time using SJF algorithm with the following assumptions. No preemption.No I/O request will be there from any process.Arrival time is relative to CPU on time.Process NumberATBT103222324442View Answer

The execution of processes can be visualized …